[PT Run] Updated borderbrush to improve accessibility for dark mode (#7141)

* Updated borderbrush

* Update src/modules/launcher/PowerLauncher/LauncherControl.xaml

Co-authored-by: htcfreek <61519853+htcfreek@users.noreply.github.com>

* Fixed bug

Co-authored-by: htcfreek <61519853+htcfreek@users.noreply.github.com>
This commit is contained in:
Niels Laute
2020-10-09 05:14:00 +02:00
committed by GitHub
parent 210426a020
commit 274c009f20
10 changed files with 166 additions and 44 deletions

View File

@@ -21,7 +21,11 @@
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource ControlTextBrushKey}"/>
<Rectangle Margin="2"
StrokeDashArray="1 2"
SnapsToDevicePixels="true"
StrokeThickness="1"
Stroke="{DynamicResource ControlTextBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
@@ -38,8 +42,19 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="4" Background="Transparent" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<Border x:Name="border"
CornerRadius="2"
Background="Transparent"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="Transparent"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter"
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
@@ -72,8 +87,16 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid Background="Transparent">
<Border x:Name="HighlightBorder" BorderThickness="0" Background="{DynamicResource SystemChromeLow}" BorderBrush="Transparent" SnapsToDevicePixels="true"/>
<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<Border x:Name="HighlightBorder"
BorderThickness="0"
Background="{DynamicResource SystemChromeLow}"
BorderBrush="Transparent"
SnapsToDevicePixels="true"/>
<ContentPresenter x:Name="contentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}" RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<!-- Setting the opacity of the highlight border to improve the contrast of the AccentColorbrush when selected. In UWP we could call a different brush, in WPF we need to play with the opacity of the WindowGlassBrush-->
@@ -100,8 +123,18 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Border x:Name="border" CornerRadius="4" Background="Transparent" BorderBrush="Transparent" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<Border x:Name="border"
CornerRadius="4"
Background="Transparent"
BorderBrush="Transparent"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter"
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
@@ -137,8 +170,16 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToolTip}" >
<Grid Margin="8,2" >
<Rectangle Fill="{DynamicResource ToolTipBackgroundBrushKey}" RadiusX="4" RadiusY="4" Stroke="{DynamicResource ToolTipBorderBrushKey}" StrokeThickness="1"/>
<ContentPresenter Margin="4" HorizontalAlignment="Center" VerticalAlignment="Top" />
<Rectangle
Fill="{DynamicResource ToolTipBackgroundBrushKey}"
RadiusX="4"
RadiusY="4"
Stroke="{DynamicResource ToolTipBorderBrushKey}"
StrokeThickness="1"/>
<ContentPresenter
Margin="4"
HorizontalAlignment="Center"
VerticalAlignment="Top" />
</Grid>
</ControlTemplate>
</Setter.Value>
@@ -174,8 +215,7 @@
Width="642"
Background="Transparent"
ToolTipService.BetweenShowDelay="0"
ToolTipService.InitialShowDelay="1000"
>
ToolTipService.InitialShowDelay="1000">
<Behaviors:Interaction.Triggers>
<Behaviors:EventTrigger EventName="MouseEnter">
<Behaviors:InvokeCommandAction Command="{Binding ActivateContextButtonsHoverCommand}"/>
@@ -211,9 +251,34 @@
</StackPanel>
</ToolTip>
</Grid.ToolTip>
<Image AutomationProperties.Name="{x:Static p:Resources.AppIcon}" x:Name="AppIcon" Height="36" MaxWidth="56" Grid.RowSpan="2" Margin="-6,-2,0,0" HorizontalAlignment="Center" Source="{Binding Image}" />
<TextBlock AutomationProperties.Name="{x:Static p:Resources.Title}" x:Name="Title" Grid.Column="1" Text="{Binding Result.Title}" FontWeight="SemiBold" FontSize="20" Margin="0,0,0,-2" VerticalAlignment="Bottom" RenderOptions.ClearTypeHint="Enabled"/>
<TextBlock AutomationProperties.Name="{x:Static p:Resources.Subtitle}" x:Name="Path" Grid.Column="1" Text= "{Binding Result.SubTitle}" Grid.Row="1" Foreground="{DynamicResource SecondaryTextForeground}" Margin="0,2,0,0" VerticalAlignment="Top" RenderOptions.ClearTypeHint="Enabled"/>
<Image
AutomationProperties.Name="{x:Static p:Resources.AppIcon}"
x:Name="AppIcon"
Height="36"
MaxWidth="56"
Grid.RowSpan="2"
Margin="-6,-2,0,0"
HorizontalAlignment="Center"
Source="{Binding Image}" />
<TextBlock
AutomationProperties.Name="{x:Static p:Resources.Title}"
x:Name="Title" Grid.Column="1"
Text="{Binding Result.Title}"
FontWeight="SemiBold"
FontSize="20"
Margin="0,0,0,-2"
VerticalAlignment="Bottom"
RenderOptions.ClearTypeHint="Enabled"/>
<TextBlock
AutomationProperties.Name="{x:Static p:Resources.Subtitle}"
x:Name="Path"
Grid.Column="1"
Text= "{Binding Result.SubTitle}"
Grid.Row="1"
Foreground="{DynamicResource SecondaryTextForeground}"
Margin="0,2,0,0"
VerticalAlignment="Top"
RenderOptions.ClearTypeHint="Enabled"/>
<ListView
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemsCollection}"
HorizontalAlignment="Right"
@@ -239,14 +304,32 @@
</ItemsControl.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Button AutomationProperties.Name="{x:Static p:Resources.ContextMenuItem}" Style="{StaticResource IconButtonStyle}" Command="{Binding Command}" VerticalAlignment="Center" Height="42" Width="42" BorderThickness="1" >
<Button
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItem}"
Style="{StaticResource IconButtonStyle}"
Command="{Binding Command}"
VerticalAlignment="Center"
Height="42"
Width="42"
BorderThickness="1" >
<ToolTipService.ToolTip>
<ToolTip >
<TextBlock AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemAdditionalInformation}" Text="{Binding Title}" Foreground="{DynamicResource ToolTipForegroundBrushKey}" Margin="8,5" FontSize="12" RenderOptions.ClearTypeHint="Enabled"/>
<TextBlock
AutomationProperties.Name="{x:Static p:Resources.ContextMenuItemAdditionalInformation}"
Text="{Binding Title}"
Foreground="{DynamicResource ToolTipForegroundBrushKey}"
Margin="8,5"
FontSize="12"
RenderOptions.ClearTypeHint="Enabled"/>
</ToolTip>
</ToolTipService.ToolTip>
<Button.Content>
<TextBlock AutomationProperties.Name="{x:Static p:Resources.ContextMenuIcon}" FontFamily="{Binding FontFamily}" FontSize="16" Text="{Binding Glyph}" RenderOptions.ClearTypeHint="Enabled"/>
<TextBlock
AutomationProperties.Name="{x:Static p:Resources.ContextMenuIcon}"
FontFamily="{Binding FontFamily}"
FontSize="16"
Text="{Binding Glyph}"
RenderOptions.ClearTypeHint="Enabled"/>
</Button.Content>
</Button>
</DataTemplate>