Skip to content

Commit a738811

Browse files
authored
Merge pull request #414 from mou-haz/Fix-NumberBox
Fix NumberBox style
2 parents 1cea018 + b89688a commit a738811

1 file changed

Lines changed: 69 additions & 45 deletions

File tree

  • source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NumberBox

source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/NumberBox/NumberBox.xaml

Lines changed: 69 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,77 @@
3535
<Setter Property="FontSize" Value="12" />
3636
<Setter Property="Background" Value="Transparent" />
3737
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
38+
<Setter Property="Foreground" Value="{DynamicResource TextControlButtonForeground}" />
3839
<Setter Property="BorderThickness" Value="{DynamicResource NumberBoxSpinButtonBorderThickness}" />
3940
<Setter Property="FontFamily" Value="{DynamicResource SymbolThemeFontFamily}" />
41+
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
42+
<Setter Property="Template">
43+
<Setter.Value>
44+
<ControlTemplate TargetType="RepeatButton">
45+
<ui:ElevationBorder x:Name="Background"
46+
Background="{TemplateBinding Background}"
47+
BorderBrush="{TemplateBinding BorderBrush}"
48+
BorderThickness="{TemplateBinding BorderThickness}"
49+
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}"
50+
SnapsToDevicePixels="True">
51+
<Border x:Name="Border"
52+
Padding="{TemplateBinding Padding}"
53+
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}">
54+
<TextBlock x:Name="ContentPresenter"
55+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
56+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
57+
Focusable="False"
58+
Text="{TemplateBinding Content}"
59+
Foreground="{TemplateBinding Foreground}"
60+
FontSize="{TemplateBinding FontSize}"
61+
FontFamily="{TemplateBinding FontFamily}"
62+
FontWeight="{TemplateBinding FontWeight}"
63+
FontStyle="{TemplateBinding FontStyle}"
64+
FontStretch="{TemplateBinding FontStretch}"
65+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
66+
</Border>
67+
</ui:ElevationBorder>
68+
<ControlTemplate.Triggers>
69+
<Trigger Property="IsMouseOver"
70+
Value="True">
71+
<Setter TargetName="Background"
72+
Property="Background"
73+
Value="{DynamicResource TextControlButtonBackgroundPointerOver}" />
74+
<Setter TargetName="Background"
75+
Property="BorderBrush"
76+
Value="{DynamicResource TextControlButtonBorderBrushPointerOver}" />
77+
<Setter TargetName="ContentPresenter"
78+
Property="TextElement.Foreground"
79+
Value="{DynamicResource TextControlButtonForegroundPointerOver}" />
80+
</Trigger>
81+
<Trigger Property="IsPressed"
82+
Value="True">
83+
<Setter TargetName="Background"
84+
Property="Background"
85+
Value="{DynamicResource TextControlButtonBackgroundPressed}" />
86+
<Setter TargetName="Background"
87+
Property="BorderBrush"
88+
Value="{DynamicResource TextControlButtonBorderBrushPressed}" />
89+
<Setter TargetName="ContentPresenter"
90+
Property="TextElement.Foreground"
91+
Value="{DynamicResource TextControlButtonForegroundPressed}" />
92+
</Trigger>
93+
<Trigger Property="IsEnabled"
94+
Value="False">
95+
<Setter TargetName="Background"
96+
Property="Background"
97+
Value="{DynamicResource RepeatButtonBackgroundDisabled}" />
98+
<Setter TargetName="Background"
99+
Property="BorderBrush"
100+
Value="{DynamicResource TextControlButtonBorderBrush}" />
101+
<Setter TargetName="ContentPresenter"
102+
Property="TextElement.Foreground"
103+
Value="{DynamicResource RepeatButtonForegroundDisabled}" />
104+
</Trigger>
105+
</ControlTemplate.Triggers>
106+
</ControlTemplate>
107+
</Setter.Value>
108+
</Setter>
40109
</Style.Setters>
41110
</Style>
42111

@@ -289,51 +358,6 @@
289358
<Setter.Value>
290359
<ControlTemplate TargetType="local:NumberBox">
291360
<Grid ui:ThemeManager.HasThemeResources="True" Height="{TemplateBinding Height}">
292-
<Grid.Resources>
293-
<ui:ResourceDictionaryEx>
294-
<ui:ResourceDictionaryEx.ThemeDictionaries>
295-
<ResourceDictionary x:Key="Light" ui:ThemeDictionary.Key="Light">
296-
<ui:StaticResource x:Key="RepeatButtonBackground" ResourceKey="TextControlButtonBackground" />
297-
<ui:StaticResource x:Key="RepeatButtonBackgroundPointerOver" ResourceKey="TextControlButtonBackgroundPointerOver" />
298-
<ui:StaticResource x:Key="RepeatButtonBackgroundPressed" ResourceKey="TextControlButtonBackgroundPressed" />
299-
<ui:StaticResource x:Key="RepeatButtonForeground" ResourceKey="TextControlButtonForeground" />
300-
<ui:StaticResource x:Key="RepeatButtonForegroundPointerOver" ResourceKey="TextControlButtonForegroundPointerOver" />
301-
<ui:StaticResource x:Key="RepeatButtonForegroundPressed" ResourceKey="TextControlButtonForegroundPressed" />
302-
<ui:StaticResource x:Key="RepeatButtonBorderBrush" ResourceKey="TextControlButtonBorderBrush" />
303-
<ui:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="TextControlButtonBorderBrushPointerOver" />
304-
<ui:StaticResource x:Key="RepeatButtonBorderBrushPressed" ResourceKey="TextControlButtonBorderBrushPressed" />
305-
<ui:StaticResource x:Key="RepeatButtonBorderBrushDisabled" ResourceKey="TextControlButtonBorderBrush" />
306-
</ResourceDictionary>
307-
308-
<ResourceDictionary x:Key="Dark" ui:ThemeDictionary.Key="Dark">
309-
<ui:StaticResource x:Key="RepeatButtonBackground" ResourceKey="TextControlButtonBackground" />
310-
<ui:StaticResource x:Key="RepeatButtonBackgroundPointerOver" ResourceKey="TextControlButtonBackgroundPointerOver" />
311-
<ui:StaticResource x:Key="RepeatButtonBackgroundPressed" ResourceKey="TextControlButtonBackgroundPressed" />
312-
<ui:StaticResource x:Key="RepeatButtonForeground" ResourceKey="TextControlButtonForeground" />
313-
<ui:StaticResource x:Key="RepeatButtonForegroundPointerOver" ResourceKey="TextControlButtonForegroundPointerOver" />
314-
<ui:StaticResource x:Key="RepeatButtonForegroundPressed" ResourceKey="TextControlButtonForegroundPressed" />
315-
<ui:StaticResource x:Key="RepeatButtonBorderBrush" ResourceKey="TextControlButtonBorderBrush" />
316-
<ui:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="TextControlButtonBorderBrushPointerOver" />
317-
<ui:StaticResource x:Key="RepeatButtonBorderBrushPressed" ResourceKey="TextControlButtonBorderBrushPressed" />
318-
<ui:StaticResource x:Key="RepeatButtonBorderBrushDisabled" ResourceKey="TextControlButtonBorderBrush" />
319-
</ResourceDictionary>
320-
321-
<ResourceDictionary x:Key="HighContrast" ui:ThemeDictionary.Key="HighContrast">
322-
<ui:StaticResource x:Key="RepeatButtonBackground" ResourceKey="TextControlButtonBackground" />
323-
<ui:StaticResource x:Key="RepeatButtonBackgroundPointerOver" ResourceKey="TextControlButtonBackgroundPointerOver" />
324-
<ui:StaticResource x:Key="RepeatButtonBackgroundPressed" ResourceKey="TextControlButtonBackgroundPressed" />
325-
<ui:StaticResource x:Key="RepeatButtonForeground" ResourceKey="TextControlButtonForeground" />
326-
<ui:StaticResource x:Key="RepeatButtonForegroundPointerOver" ResourceKey="TextControlButtonForegroundPointerOver" />
327-
<ui:StaticResource x:Key="RepeatButtonForegroundPressed" ResourceKey="TextControlButtonForegroundPressed" />
328-
<ui:StaticResource x:Key="RepeatButtonBorderBrush" ResourceKey="TextControlButtonBorderBrush" />
329-
<ui:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="TextControlButtonBorderBrushPointerOver" />
330-
<ui:StaticResource x:Key="RepeatButtonBorderBrushPressed" ResourceKey="TextControlButtonBorderBrushPressed" />
331-
<ui:StaticResource x:Key="RepeatButtonBorderBrushDisabled" ResourceKey="TextControlButtonBorderBrush" />
332-
</ResourceDictionary>
333-
</ui:ResourceDictionaryEx.ThemeDictionaries>
334-
</ui:ResourceDictionaryEx>
335-
</Grid.Resources>
336-
337361
<Grid.RowDefinitions>
338362
<RowDefinition Height="Auto" />
339363
<RowDefinition Height="*" />

0 commit comments

Comments
 (0)