Skip to content

Commit 8e2766d

Browse files
committed
Some clean-up:
1. Formatted the code I touched so that different attributes are on different lines, while avoiding touching unnecessary lines. 2. Removed visualstates and visualstategroups from CalendarButton that CalendarButton doesn't actually support.
1 parent a727088 commit 8e2766d

File tree

1 file changed

+60
-54
lines changed

1 file changed

+60
-54
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Calendar.xaml

Lines changed: 60 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -89,56 +89,40 @@
8989
<VisualState x:Name="Active"/>
9090
<VisualState x:Name="Inactive" />
9191
</VisualStateGroup>
92-
<VisualStateGroup x:Name="DayStates">
93-
<VisualStateGroup.Transitions>
94-
<VisualTransition GeneratedDuration="0"/>
95-
</VisualStateGroup.Transitions>
96-
<VisualState x:Name="RegularDay"/>
97-
<VisualState x:Name="Today">
98-
<Storyboard>
99-
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="TodayBackground"/>
100-
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground)" Storyboard.TargetName="NormalText">
101-
<DiscreteObjectKeyFrame Value="{DynamicResource PrimaryHueLightForegroundBrush}" KeyTime="0" />
102-
</ObjectAnimationUsingKeyFrames>
103-
</Storyboard>
104-
</VisualState>
105-
</VisualStateGroup>
106-
<VisualStateGroup x:Name="BlackoutDayStates">
107-
<VisualStateGroup.Transitions>
108-
<VisualTransition GeneratedDuration="0"/>
109-
</VisualStateGroup.Transitions>
110-
<VisualState x:Name="NormalDay"/>
111-
<VisualState x:Name="BlackoutDay">
112-
<Storyboard>
113-
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightingBorder" />
114-
<DoubleAnimation Duration="0" To="0.38" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="NormalText" />
115-
</Storyboard>
116-
</VisualState>
117-
</VisualStateGroup>
11892
</VisualStateManager.VisualStateGroups>
119-
<Ellipse x:Name="TodayBackground" Fill="{DynamicResource PrimaryHueLightBrush}" Opacity="0" />
120-
<Ellipse x:Name="SelectedBackground" Fill="{DynamicResource PrimaryHueMidBrush}" Opacity="0" />
121-
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
122-
<Border x:Name="HighlightingBorder" Opacity="1">
123-
<Ellipse x:Name="HighlightBackground" Fill="{DynamicResource PrimaryHueDarkBrush}" Opacity="0" />
124-
</Border>
125-
<ContentPresenter x:Name="NormalText"
126-
TextElement.Foreground="{TemplateBinding Foreground}"
93+
<Ellipse x:Name="TodayBackground"
94+
Fill="{DynamicResource PrimaryHueLightBrush}"
95+
Opacity="0" />
96+
<Ellipse x:Name="SelectedBackground"
97+
Fill="{DynamicResource PrimaryHueMidBrush}"
98+
Opacity="0" />
99+
<Border BorderBrush="{TemplateBinding BorderBrush}"
100+
BorderThickness="{TemplateBinding BorderThickness}"
101+
Background="{TemplateBinding Background}" />
102+
<Ellipse x:Name="HighlightBackground"
103+
Fill="{DynamicResource PrimaryHueDarkBrush}"
104+
Opacity="0" />
105+
<ContentPresenter x:Name="NormalText"
106+
TextElement.Foreground="{TemplateBinding Foreground}"
127107
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
128-
Margin="5,1,5,1"
108+
Margin="5,1,5,1"
129109
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
130-
<Ellipse x:Name="DayButtonFocusVisual" Stroke="{DynamicResource PrimaryHueDarkBrush}" Opacity="0" Visibility="Collapsed" StrokeThickness="1" />
110+
<Ellipse x:Name="DayButtonFocusVisual"
111+
Stroke="{DynamicResource PrimaryHueDarkBrush}"
112+
Opacity="0"
113+
Visibility="Collapsed"
114+
StrokeThickness="1" />
131115
</Grid>
132116
</ControlTemplate>
133117
</Setter.Value>
134118
</Setter>
135119
<Style.Triggers>
136-
<Trigger Property="IsInactive" Value="True">
137-
<Setter Property="MinHeight" Value="0" />
138-
<Setter Property="MaxHeight" Value="0" />
139-
</Trigger>
140-
<Trigger Property="IsBlackedOut" Value="True">
141-
<Setter Property="Cursor" Value="No" />
120+
<Trigger Property="IsInactive"
121+
Value="True">
122+
<Setter Property="MinHeight"
123+
Value="0" />
124+
<Setter Property="MaxHeight"
125+
Value="0" />
142126
</Trigger>
143127
</Style.Triggers>
144128
</Style>
@@ -261,25 +245,47 @@
261245
</VisualState>
262246
</VisualStateGroup>
263247
</VisualStateManager.VisualStateGroups>
264-
<Ellipse x:Name="TodayBackground" Fill="{DynamicResource PrimaryHueLightBrush}" Opacity="0" />
265-
<Ellipse x:Name="SelectedBackground" Fill="{DynamicResource PrimaryHueMidBrush}" Opacity="0" />
266-
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
267-
<Border x:Name="HighlightingBorder" Opacity="1">
268-
<Ellipse x:Name="HighlightBackground" Fill="{DynamicResource PrimaryHueDarkBrush}" Opacity="0"/>
248+
<Ellipse x:Name="TodayBackground"
249+
Fill="{DynamicResource PrimaryHueLightBrush}"
250+
Opacity="0" />
251+
<Ellipse x:Name="SelectedBackground"
252+
Fill="{DynamicResource PrimaryHueMidBrush}"
253+
Opacity="0" />
254+
<Border BorderBrush="{TemplateBinding BorderBrush}"
255+
BorderThickness="{TemplateBinding BorderThickness}"
256+
Background="{TemplateBinding Background}"/>
257+
<Border x:Name="HighlightingBorder"
258+
Opacity="1">
259+
<Ellipse x:Name="HighlightBackground"
260+
Fill="{DynamicResource PrimaryHueDarkBrush}"
261+
Opacity="0"/>
269262
</Border>
270-
<ContentPresenter x:Name="NormalText" TextElement.Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,1,5,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
271-
<Ellipse x:Name="DayButtonFocusVisual" Stroke="{DynamicResource PrimaryHueDarkBrush}" Opacity="0" Visibility="Collapsed" StrokeThickness="1"/>
263+
<ContentPresenter x:Name="NormalText"
264+
TextElement.Foreground="{TemplateBinding Foreground}"
265+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
266+
Margin="5,1,5,1"
267+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
268+
<Ellipse x:Name="DayButtonFocusVisual"
269+
Stroke="{DynamicResource PrimaryHueDarkBrush}"
270+
Opacity="0"
271+
Visibility="Collapsed"
272+
StrokeThickness="1"/>
272273
</Grid>
273274
</ControlTemplate>
274275
</Setter.Value>
275276
</Setter>
276277
<Style.Triggers>
277-
<Trigger Property="IsInactive" Value="True">
278-
<Setter Property="MinHeight" Value="0" />
279-
<Setter Property="MaxHeight" Value="0" />
278+
<Trigger Property="IsInactive"
279+
Value="True">
280+
<Setter Property="MinHeight"
281+
Value="0" />
282+
<Setter Property="MaxHeight"
283+
Value="0" />
280284
</Trigger>
281-
<Trigger Property="IsBlackedOut" Value="True">
282-
<Setter Property="Cursor" Value="No" />
285+
<Trigger Property="IsBlackedOut"
286+
Value="True">
287+
<Setter Property="Cursor"
288+
Value="No" />
283289
</Trigger>
284290
</Style.Triggers>
285291
</Style>

0 commit comments

Comments
 (0)