Initial dark mode support for all windows

This commit is contained in:
Peter Kirmeier 2023-08-14 02:16:47 +02:00
parent 09100cf821
commit 6fd41894c4
7 changed files with 125 additions and 42 deletions

View file

@ -3,6 +3,7 @@
<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>
@ -13,26 +14,85 @@
<BitmapImage x:Key="LoadingIconImage" UriSource="../Resources/Loading.ico" />
<BitmapImage x:Key="NotFoundIconImage" UriSource="../Resources/NotFound.ico" />
<Style TargetType="{x:Type TextBox}">
<!-- Please update HotkeySelector as well -->
<Setter Property="Height" Value="21" />
<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}" />
</Style>
<Style TargetType="{x:Type CheckBox}">
<Setter Property="Margin" Value="3" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<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 RadioButton}">
<Setter Property="Margin" Value="3" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style TargetType="{x:Type TabControl}">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style TargetType="{x:Type Button}">
<Setter Property="MinWidth" Value="76" />
<Setter Property="Margin" Value="2" />
<Setter Property="Padding" Value="5,3" />
<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}" />
</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>
</Application.Resources>

View file

@ -5,8 +5,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="clr-namespace:SystemTrayMenu.Utilities"
xmlns:stm="clr-namespace:SystemTrayMenu"
x:Class="SystemTrayMenu.UserInterface.AboutBox"
mc:Ignorable="d" Title="{u:Translate 'About SystemTrayMenu'}" Height="513" Width="418" ResizeMode="NoResize" SizeToContent="Height">
mc:Ignorable="d" Title="{u:Translate 'About SystemTrayMenu'}" Background="{x:Static stm:MenuDefines.ColorBackground}" Height="513" Width="418" ResizeMode="NoResize" SizeToContent="Height">
<DockPanel>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" DockPanel.Dock="Top">
<Image Width="32" Height="32" Margin="3" Source="{StaticResource ApplicationImage}" />
@ -21,9 +22,9 @@
<Label x:Name="AppCopyrightLabel" Content="Copyright © %year%, %company%" Padding="0" Margin="3" DockPanel.Dock="Top"/>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" DockPanel.Dock="Bottom">
<Button x:Name="buttonSystemInfo" Content="{u:Translate 'System Info'}" Margin="3" MinWidth="79" Height="25" Click="SysInfoButton_Click"/>
<Button x:Name="buttonDetails" Content="{u:Translate 'Details'}" Margin="3" MinWidth="76" Height="25" Click="DetailsButton_Click"/>
<Button x:Name="buttonOk" Content="{u:Translate 'OK'}" Margin="3" MinWidth="76" Height="25" Click="OkButton_Click"/>
<Button x:Name="buttonSystemInfo" Content="{u:Translate 'System Info'}" Click="SysInfoButton_Click"/>
<Button x:Name="buttonDetails" Content="{u:Translate 'Details'}" Click="DetailsButton_Click"/>
<Button x:Name="buttonOk" Content="{u:Translate 'OK'}" Click="OkButton_Click"/>
</StackPanel>
<RichTextBox x:Name="MoreRichTextBox" Height="100" DockPanel.Dock="Top" ScrollViewer.CanContentScroll="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsDocumentEnabled="True">

View file

@ -9,8 +9,8 @@
xmlns:u="clr-namespace:SystemTrayMenu.Utilities"
xmlns:stm="clr-namespace:SystemTrayMenu"
x:Class="SystemTrayMenu.UserInterface.ColorPickerWindow"
mc:Ignorable="d" Title="{u:Translate 'Choose color'}" Foreground="{x:Static stm:MenuDefines.ColorForeground}" Background="{x:Static stm:MenuDefines.ColorBackground}"
WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" ResizeMode="CanResizeWithGrip">
mc:Ignorable="d" Title="{u:Translate 'Choose color'}"
WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" ResizeMode="CanResizeWithGrip">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -18,7 +18,7 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" x:Name="lblDescription" x:FieldModifier="private" Content="" Foreground="{x:Static stm:MenuDefines.ColorForeground}" Padding="5 3" VerticalAlignment="Center"/>
<Label Grid.Row="0" x:Name="lblDescription" x:FieldModifier="private" Content="" Padding="5,3" VerticalAlignment="Center"/>
<!-- https://github.com/PixiEditor/ColorPicker -->
<colorpicker:StandardColorPicker Grid.Row="1" x:Name="picker" x:FieldModifier="private" Width="200" Height="380" ShowAlpha="False"/>

View file

@ -5,11 +5,16 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="clr-namespace:SystemTrayMenu.Utilities"
xmlns:stm="clr-namespace:SystemTrayMenu"
x:Class="SystemTrayMenu.UserInterface.HowToOpenSettingsWindow"
mc:Ignorable="d" Title="{u:Translate 'Hint'}" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" WindowStyle="SingleBorderWindow" ShowInTaskbar="True" ResizeMode="NoResize">
mc:Ignorable="d" Title="{u:Translate 'Hint'}" Background="{x:Static stm:MenuDefines.ColorBackground}" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" WindowStyle="SingleBorderWindow" ShowInTaskbar="True" ResizeMode="NoResize">
<Window.Resources>
<BitmapImage x:Key="HowToOpenSettingsImage" UriSource="../Resources/HowToOpenSettings.png" />
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{x:Static stm:MenuDefines.ColorForeground}" />
<Setter Property="Background" Value="{x:Static stm:MenuDefines.ColorBackground}" />
</Style>
</Window.Resources>
<Grid>
@ -25,7 +30,7 @@
<CheckBox Grid.Row="2" Margin="5" x:Name="checkBoxDontShowThisHintAgain" Content="???" />
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="buttonOk" Content="{u:Translate 'OK'}" Margin="3" MinWidth="76" Click="ButtonOk_Click" IsDefault="True"/>
<Button x:Name="buttonOk" Content="{u:Translate 'OK'}" Click="ButtonOk_Click" IsDefault="True"/>
</StackPanel>
</Grid>
</Window>

View file

@ -4,8 +4,30 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:stm="clr-namespace:SystemTrayMenu"
x:Class="SystemTrayMenu.UserInterface.NumericUpDown"
mc:Ignorable="d" d:Height="21" Margin="1,1,5,1" Width="76">
<UserControl.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Border" Margin="0" Padding="0" 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>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
@ -19,10 +41,10 @@
<TextBox Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" x:Name="txtbox" x:FieldModifier="private" VerticalContentAlignment="Center" Text="0" Margin="0,0,1,0"
PreviewTextInput="Txtbox_PreviewTextInput" DataObject.Pasting="Txtbox_Pasting" PreviewMouseWheel="Txtbox_PreviewMouseWheel" TextChanged="Txtbox_TextChanged"/>
<Button Grid.Row="0" Grid.Column="1" Margin="0" Padding="0" Click="ButtonUp_Click" MinWidth="0">
<Polygon Points="2,4 6,1 10,4" Stroke="Black" Fill="Black" />
<Polygon Points="2,4 6,1 10,4" Stroke="{x:Static stm:MenuDefines.ColorForeground}" Fill="{x:Static stm:MenuDefines.ColorForeground}" />
</Button>
<Button Grid.Row="1" Grid.Column="1" Margin="0" Padding="0" Click="ButtonDown_Click" MinWidth="0">
<Polygon Points="2,1 10,1 6,4" Stroke="Black" Fill="Black" />
<Polygon Points="2,1 10,1 6,4" Stroke="{x:Static stm:MenuDefines.ColorForeground}" Fill="{x:Static stm:MenuDefines.ColorForeground}" />
</Button>
</Grid>
</UserControl>

View file

@ -5,9 +5,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="clr-namespace:SystemTrayMenu.Utilities"
xmlns:stm="clr-namespace:SystemTrayMenu"
xmlns:local="clr-namespace:SystemTrayMenu.UserInterface"
x:Class="SystemTrayMenu.UserInterface.SettingsWindow"
mc:Ignorable="d" Title="{u:Translate 'Settings'}" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" MinWidth="200" MinHeight="250">
mc:Ignorable="d" Title="{u:Translate 'Settings'}" Background="{x:Static stm:MenuDefines.ColorBackground}" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" MinWidth="200" MinHeight="250">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />

View file

@ -5,23 +5,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="clr-namespace:SystemTrayMenu.Utilities"
xmlns:stm="clr-namespace:SystemTrayMenu"
x:Class="SystemTrayMenu.UserInterface.UpdateWindow"
mc:Ignorable="d" Title="{u:Translate 'New version available!'}" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" MinWidth="600" MinHeight="400" WindowStyle="ToolWindow" ShowInTaskbar="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
mc:Ignorable="d" Title="{u:Translate 'New version available!'}" Background="{x:Static stm:MenuDefines.ColorBackground}" WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight" MinWidth="600" MaxHeight="600" WindowStyle="ToolWindow" ShowInTaskbar="False">
<DockPanel>
<Label DockPanel.Dock="Top" x:Name="label" Content="{u:Translate 'Latest available version:'}" />
<Label Grid.Row="0" x:Name="label" Content="{u:Translate 'Latest available version:'}" />
<!-- TODO: Adjust MaxHeight? -->
<TextBox Grid.Row="1" x:Name="textBox" MaxHeight="600" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsReadOnly="True"/>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="buttonGoToDownloadPage" Content="{u:Translate 'Go to download page'}" Margin="3" MinWidth="76" Click="ButtonGoToDownloadPage_Click"/>
<Button x:Name="buttonOk" Content="{u:Translate 'OK'}" Margin="3" MinWidth="76" Click="ButtonOk_Click" IsDefault="True"/>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="buttonGoToDownloadPage" Content="{u:Translate 'Go to download page'}" Click="ButtonGoToDownloadPage_Click"/>
<Button x:Name="buttonOk" Content="{u:Translate 'OK'}" Click="ButtonOk_Click" IsDefault="True"/>
</StackPanel>
</Grid>
<TextBox x:Name="textBox" Margin="5" Height="Auto" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Top" IsReadOnly="True"/>
</DockPanel>
</Window>