SystemTrayMenu/Business/App.xaml
Peter Kirmeier ae6b12600c Use global style for all windows
Including foreground and background color, clear type rendering and using layout rounding
2023-09-01 17:34:42 +02:00

112 lines
6.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2022-2023 Peter Kirmeier -->
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:stm="clr-namespace:SystemTrayMenu"
x:Class="SystemTrayMenu.App" ShutdownMode="OnExplicitShutdown">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/ScrollBarStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<BitmapImage x:Key="ApplicationImage" UriSource="../Resources/SystemTrayMenu.png" />
<BitmapImage x:Key="ApplicationIconImage" UriSource="../Resources/SystemTrayMenu.ico" />
<BitmapImage x:Key="LinkArrowIconImage" UriSource="../Resources/LinkArrow.ico" />
<BitmapImage x:Key="LoadingIconImage" UriSource="../Resources/Loading.ico" />
<BitmapImage x:Key="NotFoundIconImage" UriSource="../Resources/NotFound.ico" />
<SolidColorBrush x:Key="ButtonHoverColor" Color="Gray" Opacity="0.5"/>
<Style TargetType="{x:Type Window}">
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
<Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" />
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
<Setter Property="UseLayoutRounding" Value="True" />
</Style>
<Style TargetType="{x:Type TabItem}">
<!-- not working for selected TabIdem yet, so we keep default colors -->
<!--Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" /-->
<!--Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" /-->
</Style>
<Style TargetType="{x:Type TabControl}">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style TargetType="{x:Type TextBlock}">
<!--not used yet as several controls are using it but overwriting colors let them look bad -->
<!--Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" /-->
<!--Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" /-->
</Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
</Style>
<Style TargetType="{x:Type GroupBox}">
<Setter Property="Margin" Value="2" />
<Setter Property="Padding" Value="2" />
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
</Style>
<Style TargetType="{x:Type TextBox}">
<!-- Please update HotkeySelector as well -->
<Setter Property="Height" Value="21" />
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
<Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" />
<Setter Property="SelectionTextBrush" Value="White" />
<Setter Property="SelectionBrush" Value="#0078d7" />
</Style>
<Style TargetType="{x:Type RichTextBox}">
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
<Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" />
</Style>
<Style TargetType="{x:Type CheckBox}">
<Setter Property="Margin" Value="3" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
</Style>
<Style TargetType="{x:Type ComboBox}">
<!-- not working for selected TabIdem yet, so we keep default colors -->
<!--Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" /-->
<!--Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" /-->
</Style>
<Style TargetType="{x:Type ListView}">
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
<Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" />
</Style>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="3" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
</Style>
<Style TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="76" />
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
<!-- TODO: Find better solution instead of re-implementing the control template of a button,
only to manage changing the mouse hover border color. -->
<Setter Property="BorderBrush" Value="{StaticResource ButtonHoverColor}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" Margin="2" Padding="7,5" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{x:Static stm:MenuDefines.ColorSelectedItemBorder}" TargetName="Border" />
<Setter Property="Background" Value="{StaticResource ButtonHoverColor}" TargetName="Border" />
<Setter Property="Opacity" Value="0.9" TargetName="Border" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>