Skip to content

Commit bd0d33a

Browse files
committed
updated patch to follow tab formatting
1 parent b8f60ab commit bd0d33a

File tree

1 file changed

+86
-91
lines changed

1 file changed

+86
-91
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ToggleButton.xaml

Lines changed: 86 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -177,98 +177,93 @@
177177
<Setter Property="Foreground" Value="{DynamicResource SecondaryAccentForegroundBrush}"/>
178178
</Style>
179179

180-
<Style x:Key="MaterialDesignFlatToggleButton" TargetType="{x:Type ToggleButton}">
181-
<Setter Property="Foreground" Value="#616161"/>
182-
<Setter Property="Background" Value="#e0e0e0"/>
183-
<Setter Property="Width" Value="40"/>
184-
<Setter Property="Height" Value="40"/>
185-
<Setter Property="FontSize" Value="18"/>
186-
<Setter Property="HorizontalContentAlignment" Value="Center"/>
187-
<Setter Property="VerticalContentAlignment" Value="Center"/>
188-
<Setter Property="Padding" Value="0"/>
189-
<Setter Property="Template">
190-
<Setter.Value>
191-
<ControlTemplate TargetType="{x:Type ToggleButton}">
192-
<Grid ClipToBounds="True" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
193-
<VisualStateManager.VisualStateGroups>
194-
<VisualStateGroup x:Name="CommonStates">
195-
<VisualState x:Name="Normal"/>
196-
<VisualState x:Name="Disabled">
197-
<Storyboard>
198-
<DoubleAnimation Duration="0" To="0.23" Storyboard.TargetProperty="(UIElement.Opacity)" />
199-
</Storyboard>
200-
</VisualState>
201-
</VisualStateGroup>
202-
<VisualStateGroup x:Name="CheckStates">
203-
<VisualStateGroup.Transitions>
204-
<VisualTransition From="*" To="Checked">
205-
<Storyboard>
206-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale">
207-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
208-
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.1" />
209-
</DoubleAnimationUsingKeyFrames>
210-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale">
211-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
212-
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.1" />
213-
</DoubleAnimationUsingKeyFrames>
214-
</Storyboard>
215-
</VisualTransition>
216-
<VisualTransition From="Checked" To="Unchecked">
217-
<Storyboard>
218-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale">
219-
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.0" />
220-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
221-
</DoubleAnimationUsingKeyFrames>
222-
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale">
223-
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.0" />
224-
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
225-
</DoubleAnimationUsingKeyFrames>
226-
</Storyboard>
227-
</VisualTransition>
228-
</VisualStateGroup.Transitions>
229-
<VisualState x:Name="Checked">
230-
<Storyboard>
231-
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale"
232-
To="1.0" />
233-
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale"
234-
To="1.0" />
235-
</Storyboard>
236-
</VisualState>
237-
<VisualState x:Name="Unchecked">
238-
<Storyboard>
239-
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale"
240-
To="0" />
241-
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale"
242-
To="0" />
243-
</Storyboard>
244-
</VisualState>
245-
</VisualStateGroup>
246-
</VisualStateManager.VisualStateGroups>
247-
<Ellipse Fill="Transparent" x:Name="HoverEllipse"
248-
Stroke="Transparent" StrokeThickness="1" />
249-
<Ellipse Fill="{TemplateBinding Background}" x:Name="CheckedEllipse" RenderTransformOrigin="0.5, 0.5">
250-
<Ellipse.RenderTransform>
251-
<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.0" ScaleY="1.0" x:Name="CheckedEllipseScale"/>
252-
</Ellipse.RenderTransform>
253-
</Ellipse>
254-
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
255-
</Grid>
256-
<ControlTemplate.Triggers>
257-
<Trigger Property="IsMouseOver" Value="true">
258-
<Setter Property="Stroke" TargetName="HoverEllipse" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
259-
</Trigger>
260-
<!-- TODO
261-
<Trigger Property="IsFocused" Value="True">
262-
<Setter Property="BorderBrush" TargetName="normal" Value="{Binding (Custom:ControlsHelper.FocusBorderBrush), RelativeSource={RelativeSource TemplatedParent}}"/>
263-
</Trigger>
264-
-->
265-
</ControlTemplate.Triggers>
266-
</ControlTemplate>
267-
</Setter.Value>
268-
</Setter>
269-
</Style>
180+
<Style x:Key="MaterialDesignFlatToggleButton" TargetType="{x:Type ToggleButton}">
181+
<Setter Property="Foreground" Value="#616161"/>
182+
<Setter Property="Background" Value="#e0e0e0"/>
183+
<Setter Property="Width" Value="40"/>
184+
<Setter Property="Height" Value="40"/>
185+
<Setter Property="FontSize" Value="18"/>
186+
<Setter Property="HorizontalContentAlignment" Value="Center"/>
187+
<Setter Property="VerticalContentAlignment" Value="Center"/>
188+
<Setter Property="Padding" Value="0"/>
189+
<Setter Property="Template">
190+
<Setter.Value>
191+
<ControlTemplate TargetType="{x:Type ToggleButton}">
192+
<Grid ClipToBounds="True" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
193+
<VisualStateManager.VisualStateGroups>
194+
<VisualStateGroup x:Name="CommonStates">
195+
<VisualState x:Name="Normal"/>
196+
<VisualState x:Name="Disabled">
197+
<Storyboard>
198+
<DoubleAnimation Duration="0" To="0.23" Storyboard.TargetProperty="(UIElement.Opacity)" />
199+
</Storyboard>
200+
</VisualState>
201+
</VisualStateGroup>
202+
<VisualStateGroup x:Name="CheckStates">
203+
<VisualStateGroup.Transitions>
204+
<VisualTransition From="*" To="Checked">
205+
<Storyboard>
206+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale">
207+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
208+
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.1" />
209+
</DoubleAnimationUsingKeyFrames>
210+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale">
211+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
212+
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.1" />
213+
</DoubleAnimationUsingKeyFrames>
214+
</Storyboard>
215+
</VisualTransition>
216+
<VisualTransition From="Checked" To="Unchecked">
217+
<Storyboard>
218+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale">
219+
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.0" />
220+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
221+
</DoubleAnimationUsingKeyFrames>
222+
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale">
223+
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.0" />
224+
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
225+
</DoubleAnimationUsingKeyFrames>
226+
</Storyboard>
227+
</VisualTransition>
228+
</VisualStateGroup.Transitions>
229+
<VisualState x:Name="Checked">
230+
<Storyboard>
231+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale" To="1.0" />
232+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale" To="1.0" />
233+
</Storyboard>
234+
</VisualState>
235+
<VisualState x:Name="Unchecked">
236+
<Storyboard>
237+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale" To="0" />
238+
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale" To="0" />
239+
</Storyboard>
240+
</VisualState>
241+
</VisualStateGroup>
242+
</VisualStateManager.VisualStateGroups>
243+
<Ellipse Fill="Transparent" x:Name="HoverEllipse" Stroke="Transparent" StrokeThickness="1" />
244+
<Ellipse Fill="{TemplateBinding Background}" x:Name="CheckedEllipse" RenderTransformOrigin="0.5, 0.5">
245+
<Ellipse.RenderTransform>
246+
<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.0" ScaleY="1.0" x:Name="CheckedEllipseScale"/>
247+
</Ellipse.RenderTransform>
248+
</Ellipse>
249+
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
250+
</Grid>
251+
<ControlTemplate.Triggers>
252+
<Trigger Property="IsMouseOver" Value="true">
253+
<Setter Property="Stroke" TargetName="HoverEllipse" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
254+
</Trigger>
255+
<!-- TODO
256+
<Trigger Property="IsFocused" Value="True">
257+
<Setter Property="BorderBrush" TargetName="normal" Value="{Binding (Custom:ControlsHelper.FocusBorderBrush), RelativeSource={RelativeSource TemplatedParent}}"/>
258+
</Trigger>
259+
-->
260+
</ControlTemplate.Triggers>
261+
</ControlTemplate>
262+
</Setter.Value>
263+
</Setter>
264+
</Style>
270265

271-
<Style x:Key="MaterialDesignFlatPrimaryToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignFlatToggleButton}">
266+
<Style x:Key="MaterialDesignFlatPrimaryToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignFlatToggleButton}">
272267
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}"/>
273268
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkBrush}"/>
274269
</Style>

0 commit comments

Comments
 (0)