Skip to content

Commit 6694431

Browse files
authored
Setting SelectionBrush for TextBox and other controls (#10798)
1 parent 508c792 commit 6694431

File tree

9 files changed

+22
-0
lines changed

9 files changed

+22
-0
lines changed

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Resources/Theme/Dark.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@
783783
</LinearGradientBrush.GradientStops>
784784
</LinearGradientBrush>
785785
<SolidColorBrush x:Key="TextControlBorderBrushDisabled" Color="{StaticResource ControlStrokeColorDefault}" />
786+
<SolidColorBrush x:Key="TextControlSelectionHighlightColor" Color="{StaticResource SystemAccentColor}" />
786787

787788
<!-- Deprecated TextControl Brushes -->
788789
<SolidColorBrush x:Key="TextControlFocusedBorderBrush" Color="{StaticResource SystemAccentColorLight2}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Resources/Theme/HC.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@
589589
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="{StaticResource SystemColorHighlightColor}" />
590590
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="{StaticResource SystemColorHighlightColor}" />
591591
<SolidColorBrush x:Key="TextControlBorderBrushDisabled" Color="{StaticResource SystemColorGrayTextColor}" />
592+
<SolidColorBrush x:Key="TextControlSelectionHighlightColor" Color="{StaticResource SystemColorWindowColor}" />
592593

593594
<!-- Deprecated TextControl Brushes -->
594595
<SolidColorBrush x:Key="TextControlFocusedBorderBrush" Color="{StaticResource SystemColorHighlightColor}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Resources/Theme/Light.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@
792792
</LinearGradientBrush.GradientStops>
793793
</LinearGradientBrush>
794794
<SolidColorBrush x:Key="TextControlBorderBrushDisabled" Color="{StaticResource ControlStrokeColorDefault}" />
795+
<SolidColorBrush x:Key="TextControlSelectionHighlightColor" Color="{StaticResource SystemAccentColor}" />
795796

796797
<!-- Deprecated TextControl Brushes -->
797798
<SolidColorBrush x:Key="TextControlFocusedBorderBrush" Color="{StaticResource SystemAccentColorDark1}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/PasswordBox.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
<Setter Property="PasswordChar" Value=""/>
5757
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
5858
<Setter Property="OverridesDefaultStyle" Value="True" />
59+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}"/>
5960
<Setter Property="Template">
6061
<Setter.Value>
6162
<ControlTemplate TargetType="{x:Type PasswordBox}">

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RichTextBox.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
3939
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
4040
<Setter Property="OverridesDefaultStyle" Value="True" />
41+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}"/>
4142
<Setter Property="Template">
4243
<Setter.Value>
4344
<ControlTemplate TargetType="{x:Type RichTextBox}">

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TextBox.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
5454
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
5555
<Setter Property="OverridesDefaultStyle" Value="True" />
56+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}"/>
5657
<Setter Property="Template">
5758
<Setter.Value>
5859
<ControlTemplate TargetType="{x:Type TextBoxBase}">
@@ -253,6 +254,7 @@
253254
<Setter Property="AllowDrop" Value="True"/>
254255
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
255256
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
257+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}"/>
256258
<Setter Property="Template" Value="{StaticResource DefaultTextBoxControlTemplate}" />
257259
</Style>
258260

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Dark.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@
741741
</LinearGradientBrush.GradientStops>
742742
</LinearGradientBrush>
743743
<SolidColorBrush x:Key="TextControlBorderBrushDisabled" Color="{StaticResource ControlStrokeColorDefault}" />
744+
<SolidColorBrush x:Key="TextControlSelectionHighlightColor" Color="{StaticResource SystemAccentColor}" />
744745
<!-- Deprecated TextControl Brushes -->
745746
<SolidColorBrush x:Key="TextControlFocusedBorderBrush" Color="{StaticResource SystemAccentColorLight2}" />
746747
<SolidColorBrush x:Key="TextControlPlaceholderForeground" Color="{StaticResource TextFillColorSecondary}" />
@@ -3749,6 +3750,7 @@
37493750
<Setter Property="PasswordChar" Value="" />
37503751
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
37513752
<Setter Property="OverridesDefaultStyle" Value="True" />
3753+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
37523754
<Setter Property="Template">
37533755
<Setter.Value>
37543756
<ControlTemplate TargetType="{x:Type PasswordBox}">
@@ -4094,6 +4096,7 @@
40944096
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
40954097
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
40964098
<Setter Property="OverridesDefaultStyle" Value="True" />
4099+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
40974100
<Setter Property="Template">
40984101
<Setter.Value>
40994102
<ControlTemplate TargetType="{x:Type RichTextBox}">
@@ -4827,6 +4830,7 @@
48274830
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
48284831
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
48294832
<Setter Property="OverridesDefaultStyle" Value="True" />
4833+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
48304834
<Setter Property="Template">
48314835
<Setter.Value>
48324836
<ControlTemplate TargetType="{x:Type TextBoxBase}">
@@ -4967,6 +4971,7 @@
49674971
<Setter Property="AllowDrop" Value="True" />
49684972
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
49694973
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
4974+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
49704975
<Setter Property="Template" Value="{StaticResource DefaultTextBoxControlTemplate}" />
49714976
</Style>
49724977
<Style BasedOn="{StaticResource DefaultTextBoxBaseStyle}" TargetType="{x:Type TextBoxBase}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.HC.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@
571571
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver" Color="{StaticResource SystemColorHighlightColor}" />
572572
<SolidColorBrush x:Key="TextControlBorderBrushFocused" Color="{StaticResource SystemColorHighlightColor}" />
573573
<SolidColorBrush x:Key="TextControlBorderBrushDisabled" Color="{StaticResource SystemColorGrayTextColor}" />
574+
<SolidColorBrush x:Key="TextControlSelectionHighlightColor" Color="{StaticResource SystemColorWindowColor}" />
574575
<!-- Deprecated TextControl Brushes -->
575576
<SolidColorBrush x:Key="TextControlFocusedBorderBrush" Color="{StaticResource SystemColorHighlightColor}" />
576577
<SolidColorBrush x:Key="TextControlPlaceholderForeground" Color="{StaticResource SystemColorGrayTextColor}" />
@@ -3662,6 +3663,7 @@
36623663
<Setter Property="PasswordChar" Value="" />
36633664
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
36643665
<Setter Property="OverridesDefaultStyle" Value="True" />
3666+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
36653667
<Setter Property="Template">
36663668
<Setter.Value>
36673669
<ControlTemplate TargetType="{x:Type PasswordBox}">
@@ -4007,6 +4009,7 @@
40074009
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
40084010
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
40094011
<Setter Property="OverridesDefaultStyle" Value="True" />
4012+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
40104013
<Setter Property="Template">
40114014
<Setter.Value>
40124015
<ControlTemplate TargetType="{x:Type RichTextBox}">
@@ -4740,6 +4743,7 @@
47404743
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
47414744
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
47424745
<Setter Property="OverridesDefaultStyle" Value="True" />
4746+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
47434747
<Setter Property="Template">
47444748
<Setter.Value>
47454749
<ControlTemplate TargetType="{x:Type TextBoxBase}">
@@ -4880,6 +4884,7 @@
48804884
<Setter Property="AllowDrop" Value="True" />
48814885
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
48824886
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
4887+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
48834888
<Setter Property="Template" Value="{StaticResource DefaultTextBoxControlTemplate}" />
48844889
</Style>
48854890
<Style BasedOn="{StaticResource DefaultTextBoxBaseStyle}" TargetType="{x:Type TextBoxBase}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Light.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@
750750
</LinearGradientBrush.GradientStops>
751751
</LinearGradientBrush>
752752
<SolidColorBrush x:Key="TextControlBorderBrushDisabled" Color="{StaticResource ControlStrokeColorDefault}" />
753+
<SolidColorBrush x:Key="TextControlSelectionHighlightColor" Color="{StaticResource SystemAccentColor}" />
753754
<!-- Deprecated TextControl Brushes -->
754755
<SolidColorBrush x:Key="TextControlFocusedBorderBrush" Color="{StaticResource SystemAccentColorDark1}" />
755756
<SolidColorBrush x:Key="TextControlPlaceholderForeground" Color="{StaticResource TextFillColorSecondary}" />
@@ -3758,6 +3759,7 @@
37583759
<Setter Property="PasswordChar" Value="" />
37593760
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
37603761
<Setter Property="OverridesDefaultStyle" Value="True" />
3762+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
37613763
<Setter Property="Template">
37623764
<Setter.Value>
37633765
<ControlTemplate TargetType="{x:Type PasswordBox}">
@@ -4103,6 +4105,7 @@
41034105
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
41044106
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
41054107
<Setter Property="OverridesDefaultStyle" Value="True" />
4108+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
41064109
<Setter Property="Template">
41074110
<Setter.Value>
41084111
<ControlTemplate TargetType="{x:Type RichTextBox}">
@@ -4836,6 +4839,7 @@
48364839
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
48374840
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
48384841
<Setter Property="OverridesDefaultStyle" Value="True" />
4842+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
48394843
<Setter Property="Template">
48404844
<Setter.Value>
48414845
<ControlTemplate TargetType="{x:Type TextBoxBase}">
@@ -4976,6 +4980,7 @@
49764980
<Setter Property="AllowDrop" Value="True" />
49774981
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
49784982
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
4983+
<Setter Property="SelectionBrush" Value="{DynamicResource TextControlSelectionHighlightColor}" />
49794984
<Setter Property="Template" Value="{StaticResource DefaultTextBoxControlTemplate}" />
49804985
</Style>
49814986
<Style BasedOn="{StaticResource DefaultTextBoxBaseStyle}" TargetType="{x:Type TextBoxBase}" />

0 commit comments

Comments
 (0)