Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara authored Jul 10, 2022
1 parent 6f2fa4c commit 369d7c3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 45 deletions.
60 changes: 31 additions & 29 deletions ModernWpf/Styles/RepeatButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ModernWpf.Controls"
xmlns:primitives="clr-namespace:ModernWpf.Controls.Primitives">

<Style x:Key="DefaultRepeatButtonStyle" TargetType="RepeatButton">
Expand All @@ -26,41 +27,42 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border
x:Name="Background"
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding primitives:ControlHelper.CornerRadius}"
SnapsToDevicePixels="True">
<Border
x:Name="Border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
CornerRadius="{TemplateBinding primitives:ControlHelper.CornerRadius}">
<ContentPresenter
x:Name="ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Border>
<local:ContentControlEx x:Name="ContentPresenter"
Background="{TemplateBinding Background}"
Foreground="{TemplateBinding Foreground}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
CornerRadius="{TemplateBinding primitives:ControlHelper.CornerRadius}"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
<!-- TODO
<contract7Present:ContentPresenter.BackgroundTransition>
<contract7Present:BrushTransition Duration="0:0:0.083" />
</contract7Present:ContentPresenter.BackgroundTransition>
-->
</local:ContentControlEx>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Background" Property="Background" Value="{DynamicResource RepeatButtonBackgroundPointerOver}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushPointerOver}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource RepeatButtonForegroundPointerOver}" />
<Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource RepeatButtonBackgroundPointerOver}" />
<Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushPointerOver}" />
<Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource RepeatButtonForegroundPointerOver}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="Background" Property="Background" Value="{DynamicResource RepeatButtonBackgroundPressed}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushPressed}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource RepeatButtonForegroundPressed}" />
<Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource RepeatButtonBackgroundPressed}" />
<Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushPressed}" />
<Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource RepeatButtonForegroundPressed}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Background" Property="Background" Value="{DynamicResource RepeatButtonBackgroundDisabled}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushDisabled}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource RepeatButtonForegroundDisabled}" />
<Setter TargetName="ContentPresenter" Property="Background" Value="{DynamicResource RepeatButtonBackgroundDisabled}" />
<Setter TargetName="ContentPresenter" Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushDisabled}" />
<Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource RepeatButtonForegroundDisabled}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Expand Down
16 changes: 8 additions & 8 deletions ModernWpf/ThemeResources/Dark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1306,18 +1306,18 @@

<!-- Resources for RepeatButton -->
<Thickness x:Key="RepeatButtonBorderThemeThickness">1</Thickness>
<m:StaticResource x:Key="RepeatButtonBackground" ResourceKey="ControlFillColorTertiaryBrush" />
<SolidColorBrush x:Key="RepeatButtonBackgroundPointerOver" Color="{m:StaticColor SystemBaseHighColor}" Opacity="0.1" />
<m:StaticResource x:Key="RepeatButtonBackgroundPressed" ResourceKey="ControlAltFillColorQuarternaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundDisabled" ResourceKey="ControlFillColorTertiaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackground" ResourceKey="ControlFillColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundPointerOver" ResourceKey="ControlFillColorSecondaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundPressed" ResourceKey="ControlFillColorTertiaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundDisabled" ResourceKey="ControlFillColorDisabledBrush" />
<m:StaticResource x:Key="RepeatButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundPressed" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundPressed" ResourceKey="TextFillColorSecondaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="ControlStrokeColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrush" ResourceKey="ControlElevationBorderBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="ControlElevationBorderBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushPressed" ResourceKey="ControlStrokeColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushDisabled" ResourceKey="GhostFillColorDisabledBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushDisabled" ResourceKey="ControlStrokeColorDefaultBrush" />

<!-- Resources for ResizeGrip -->
<m:StaticResource x:Key="ResizeGripForeground" ResourceKey="SystemControlForegroundBaseMediumLowBrush" />
Expand Down
16 changes: 8 additions & 8 deletions ModernWpf/ThemeResources/Light.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1305,18 +1305,18 @@

<!-- Resources for RepeatButton -->
<Thickness x:Key="RepeatButtonBorderThemeThickness">1</Thickness>
<m:StaticResource x:Key="RepeatButtonBackground" ResourceKey="ControlFillColorTertiaryBrush" />
<SolidColorBrush x:Key="RepeatButtonBackgroundPointerOver" Color="{m:StaticColor SystemBaseHighColor}" Opacity="0.1" />
<m:StaticResource x:Key="RepeatButtonBackgroundPressed" ResourceKey="ControlAltFillColorQuarternaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundDisabled" ResourceKey="ControlFillColorTertiaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackground" ResourceKey="ControlFillColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundPointerOver" ResourceKey="ControlFillColorSecondaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundPressed" ResourceKey="ControlFillColorTertiaryBrush" />
<m:StaticResource x:Key="RepeatButtonBackgroundDisabled" ResourceKey="ControlFillColorDisabledBrush" />
<m:StaticResource x:Key="RepeatButtonForeground" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundPointerOver" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundPressed" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundPressed" ResourceKey="TextFillColorSecondaryBrush" />
<m:StaticResource x:Key="RepeatButtonForegroundDisabled" ResourceKey="TextFillColorDisabledBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="ControlStrokeColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrush" ResourceKey="ControlElevationBorderBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushPointerOver" ResourceKey="ControlElevationBorderBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushPressed" ResourceKey="ControlStrokeColorDefaultBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushDisabled" ResourceKey="GhostFillColorDisabledBrush" />
<m:StaticResource x:Key="RepeatButtonBorderBrushDisabled" ResourceKey="ControlStrokeColorDefaultBrush" />

<!-- Resources for ResizeGrip -->
<m:StaticResource x:Key="ResizeGripForeground" ResourceKey="SystemControlForegroundBaseMediumLowBrush" />
Expand Down

0 comments on commit 369d7c3

Please sign in to comment.