|
13 | 13 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
14 | 14 | xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
15 | 15 |
|
16 |
| - <Thickness x:Key="PasswordBoxBorderThemeThickness">1,1,1,1</Thickness> |
| 16 | + <!-- Deprecated PasswordBox Resources ( Used in .NET 9 ) --> |
17 | 17 | <Thickness x:Key="PasswordBoxAccentBorderThemeThickness">0,0,0,1</Thickness>
|
18 | 18 | <Thickness x:Key="PasswordBoxLeftIconMargin">10,8,0,0</Thickness>
|
19 | 19 | <Thickness x:Key="PasswordBoxRightIconMargin">0,8,10,0</Thickness>
|
|
22 | 22 | <sys:Double x:Key="PasswordBoxButtonHeight">24</sys:Double>
|
23 | 23 | <sys:Double x:Key="PasswordBoxButtonIconSize">14</sys:Double>
|
24 | 24 |
|
| 25 | + <!-- These rsources are redefined in .NET 10 --> |
| 26 | + <!-- <Thickness x:Key="PasswordBoxBorderThemeThickness">1,1,1,1</Thickness> --> |
| 27 | + |
| 28 | + <Thickness x:Key="PasswordBoxBorderThemeThickness">1</Thickness> |
| 29 | + <!-- Instead of PasswordBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now |
| 30 | + will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource --> |
| 31 | + <sys:Double x:Key="PasswordBoxThemeMinHeight">32</sys:Double> |
| 32 | + |
25 | 33 | <ContextMenu x:Key="DefaultPasswordBoxContextMenu">
|
26 | 34 | <MenuItem Command="ApplicationCommands.Paste" />
|
27 | 35 | </ContextMenu>
|
28 | 36 |
|
29 | 37 | <Style x:Key="DefaultPasswordBoxStyle" TargetType="{x:Type PasswordBox}">
|
30 |
| - <!-- Universal WPF UI focus --> |
31 | 38 | <Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
32 |
| - <!-- Universal WPF UI ContextMenu --> |
33 | 39 | <Setter Property="ContextMenu" Value="{DynamicResource DefaultPasswordBoxContextMenu}" />
|
34 | 40 | <Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
|
35 | 41 | <Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
|
36 | 42 | <Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
|
37 |
| - <Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" /> |
| 43 | + <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> |
38 | 44 | <Setter Property="BorderThickness" Value="{StaticResource PasswordBoxBorderThemeThickness}" />
|
39 |
| - <Setter Property="HorizontalAlignment" Value="Stretch" /> |
40 |
| - <Setter Property="VerticalAlignment" Value="Center" /> |
41 |
| - <Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
| 45 | + <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" /> |
| 46 | + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" /> |
| 47 | + <Setter Property="HorizontalContentAlignment" Value="Left" /> |
42 | 48 | <Setter Property="VerticalContentAlignment" Value="Top" />
|
43 |
| - <Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" /> |
| 49 | + <Setter Property="Cursor" Value="IBeam" /> |
| 50 | + <Setter Property="MinHeight" Value="{DynamicResource PasswordBoxThemeMinHeight}" /> |
44 | 51 | <Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
|
45 | 52 | <Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
|
46 |
| - <Setter Property="PasswordChar" Value="●"/> |
47 | 53 | <Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
48 |
| - <Setter Property="SnapsToDevicePixels" Value="True" /> |
| 54 | + <Setter Property="AllowDrop" Value="True"/> |
| 55 | + <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> |
| 56 | + <Setter Property="PasswordChar" Value="●"/> |
| 57 | + <Setter Property="Stylus.IsFlicksEnabled" Value="False"/> |
49 | 58 | <Setter Property="OverridesDefaultStyle" Value="True" />
|
50 | 59 | <Setter Property="Template">
|
51 | 60 | <Setter.Value>
|
|
55 | 64 | x:Name="ContentBorder"
|
56 | 65 | MinWidth="{TemplateBinding MinWidth}"
|
57 | 66 | MinHeight="{TemplateBinding MinHeight}"
|
58 |
| - Padding="0" |
59 |
| - HorizontalAlignment="Stretch" |
60 |
| - VerticalAlignment="Stretch" |
61 | 67 | Background="{TemplateBinding Background}"
|
62 | 68 | BorderBrush="{TemplateBinding BorderBrush}"
|
63 | 69 | BorderThickness="{TemplateBinding BorderThickness}"
|
64 |
| - CornerRadius="{TemplateBinding Border.CornerRadius}"> |
65 |
| - <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> |
66 |
| - <Grid.ColumnDefinitions> |
67 |
| - <ColumnDefinition Width="*" /> |
68 |
| - <ColumnDefinition Width="Auto" /> |
69 |
| - </Grid.ColumnDefinitions> |
70 |
| - |
71 |
| - <Grid Grid.Column="0" Margin="{TemplateBinding Padding}"> |
72 |
| - <Decorator |
73 |
| - x:Name="PART_ContentHost" |
74 |
| - Margin="0" |
75 |
| - VerticalAlignment="Center" |
76 |
| - TextElement.Foreground="{TemplateBinding Foreground}" /> |
77 |
| - </Grid> |
78 |
| - </Grid> |
79 |
| - </Border> |
80 |
| - |
81 |
| - <!-- The Accent Border is a separate element so that changes to the border thickness do not affect the position of the element --> |
82 |
| - <Border |
83 |
| - x:Name="AccentBorder" |
84 |
| - HorizontalAlignment="Stretch" |
85 |
| - VerticalAlignment="Stretch" |
86 |
| - BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}" |
87 |
| - BorderThickness="{StaticResource PasswordBoxAccentBorderThemeThickness}" |
88 | 70 | CornerRadius="{TemplateBinding Border.CornerRadius}" />
|
| 71 | + |
| 72 | + <ScrollViewer |
| 73 | + x:Name="PART_ContentHost" |
| 74 | + Margin="{TemplateBinding BorderThickness}" |
| 75 | + CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}" |
| 76 | + HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" |
| 77 | + IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" |
| 78 | + IsTabStop="{TemplateBinding ScrollViewer.IsTabStop}" |
| 79 | + Padding="{TemplateBinding Padding}" |
| 80 | + TextElement.Foreground="{TemplateBinding Foreground}" |
| 81 | + VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" /> |
89 | 82 | </Grid>
|
90 |
| - <ControlTemplate.Triggers> |
| 83 | + <ControlTemplate.Triggers> |
| 84 | + <Trigger Property="IsMouseOver" Value="True"> |
| 85 | + <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" /> |
| 86 | + <Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushPointerOver}" /> |
| 87 | + <Setter TargetName="PART_ContentHost" Property="Foreground" Value="{DynamicResource TextControlForegroundPointerOver}" /> |
| 88 | + </Trigger> |
91 | 89 | <Trigger Property="IsFocused" Value="True">
|
92 |
| - <Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" /> |
93 |
| - <Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlFocusedBorderBrush}" /> |
| 90 | + <Setter TargetName="ContentBorder" Property="BorderThickness" Value="{StaticResource TextControlBorderThemeThicknessFocused}" /> |
94 | 91 | <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
|
95 |
| - </Trigger> |
96 |
| - <MultiTrigger> |
97 |
| - <MultiTrigger.Conditions> |
98 |
| - <Condition Property="IsEnabled" Value="True" /> |
99 |
| - <Condition Property="IsMouseOver" Value="True" /> |
100 |
| - <Condition Property="IsFocused" Value="False" /> |
101 |
| - </MultiTrigger.Conditions> |
102 |
| - <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" /> |
103 |
| - </MultiTrigger> |
104 |
| - <Trigger Property="IsEnabled" Value="True"> |
105 |
| - <Setter Property="Cursor" Value="IBeam" /> |
| 92 | + <Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushFocused}" /> |
| 93 | + <Setter TargetName="PART_ContentHost" Property="Foreground" Value="{DynamicResource TextControlForegroundFocused}" /> |
106 | 94 | </Trigger>
|
107 | 95 | <Trigger Property="IsEnabled" Value="False">
|
108 | 96 | <Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundDisabled}" />
|
109 | 97 | <Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
|
110 |
| - <Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" /> |
111 |
| - <Setter Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" /> |
| 98 | + <Setter TargetName="PART_ContentHost" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" /> |
112 | 99 | </Trigger>
|
113 | 100 | </ControlTemplate.Triggers>
|
114 | 101 | </ControlTemplate>
|
|
0 commit comments