Skip to content

Commit f8b373b

Browse files
authored
Support CornerRadius in Clock control (#4054)
* fix: Support CornerRadius in Clock control * fix: adjust fixed CornerRadius values * fix: set default CornerRadius value on missin Clock styles * refactor: move converter declaration into style resources
1 parent 4111299 commit f8b373b

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Clock.xaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"
44
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf">
55

6+
67
<Style x:Key="MaterialDesignClockItemThumb" TargetType="{x:Type Thumb}">
78
<Setter Property="Template">
89
<Setter.Value>
@@ -89,10 +90,16 @@
8990
</Style>
9091

9192
<Style x:Key="MaterialDesignClock" TargetType="{x:Type wpf:Clock}">
93+
<Style.Resources>
94+
<converters:CornerRadiusCloneConverter x:Key="FixedBottomCornerRadiusConverter"
95+
FixedBottomLeft="0"
96+
FixedBottomRight="0" />
97+
</Style.Resources>
9298
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />
9399
<Setter Property="BorderThickness" Value="1" />
94100
<Setter Property="ButtonRadiusInnerRatio" Value=".6" />
95101
<Setter Property="ButtonRadiusRatio" Value=".835" />
102+
<Setter Property="CornerRadius" Value="2"/>
96103
<Setter Property="ButtonStyle">
97104
<Setter.Value>
98105
<Style TargetType="{x:Type wpf:ClockItemButton}">
@@ -180,7 +187,7 @@
180187
<Border Background="{TemplateBinding Background}"
181188
BorderBrush="{TemplateBinding BorderBrush}"
182189
BorderThickness="{TemplateBinding BorderThickness}"
183-
CornerRadius="2">
190+
CornerRadius="{TemplateBinding CornerRadius}">
184191
<VisualStateManager.VisualStateGroups>
185192
<VisualStateGroup x:Name="DisplayModeStates">
186193
<VisualStateGroup.Transitions>
@@ -621,7 +628,7 @@
621628
<Border Height="120"
622629
Margin="0,0,0,12"
623630
Background="{DynamicResource MaterialDesign.Brush.Primary}"
624-
CornerRadius="2 2 0 0"
631+
CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource FixedBottomCornerRadiusConverter}}"
625632
Visibility="{TemplateBinding IsHeaderVisible, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}">
626633
<StackPanel x:Name="TimeReadoutStackPanel"
627634
Margin="24"
@@ -855,6 +862,7 @@
855862
<Setter Property="BorderThickness" Value="1" />
856863
<Setter Property="ButtonRadiusInnerRatio" Value=".6" />
857864
<Setter Property="ButtonRadiusRatio" Value=".835" />
865+
<Setter Property="CornerRadius" Value="2"/>
858866
<Setter Property="ButtonStyle">
859867
<Setter.Value>
860868
<Style TargetType="{x:Type wpf:ClockItemButton}">
@@ -940,7 +948,7 @@
940948
<Border Background="{TemplateBinding Background}"
941949
BorderBrush="{TemplateBinding BorderBrush}"
942950
BorderThickness="{TemplateBinding BorderThickness}"
943-
CornerRadius="2">
951+
CornerRadius="{TemplateBinding CornerRadius}">
944952
<VisualStateManager.VisualStateGroups>
945953
<VisualStateGroup x:Name="DisplayModeStates">
946954
<VisualStateGroup.Transitions>
@@ -1762,7 +1770,7 @@
17621770
<Border Background="{TemplateBinding Background}"
17631771
BorderBrush="{TemplateBinding BorderBrush}"
17641772
BorderThickness="{TemplateBinding BorderThickness}"
1765-
CornerRadius="2">
1773+
CornerRadius="{TemplateBinding CornerRadius}">
17661774
<VisualStateManager.VisualStateGroups>
17671775
<VisualStateGroup x:Name="DisplayModeStates">
17681776
<VisualStateGroup.Transitions>
@@ -2577,7 +2585,7 @@
25772585
<Border Background="{TemplateBinding Background}"
25782586
BorderBrush="{TemplateBinding BorderBrush}"
25792587
BorderThickness="{TemplateBinding BorderThickness}"
2580-
CornerRadius="2">
2588+
CornerRadius="{TemplateBinding CornerRadius}">
25812589
<VisualStateManager.VisualStateGroups>
25822590
<VisualStateGroup x:Name="DisplayModeStates">
25832591
<VisualStateGroup.Transitions>
@@ -3398,7 +3406,7 @@
33983406
<Border Background="{TemplateBinding Background}"
33993407
BorderBrush="{TemplateBinding BorderBrush}"
34003408
BorderThickness="{TemplateBinding BorderThickness}"
3401-
CornerRadius="2">
3409+
CornerRadius="{TemplateBinding CornerRadius}">
34023410
<VisualStateManager.VisualStateGroups>
34033411
<VisualStateGroup x:Name="DisplayModeStates">
34043412
<VisualStateGroup.Transitions>

0 commit comments

Comments
 (0)