Themes/MaterialDesignTheme.RadioButton.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters" xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ValidationErrorTemplate.xaml" /> </ResourceDictionary.MergedDictionaries> <Style x:Key="OptionMarkFocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="0,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeDashArray="1 2" StrokeThickness="1" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="FocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeDashArray="1 2" StrokeThickness="1" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignRadioButton" TargetType="{x:Type RadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" /> <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <ControlTemplate.Resources> <Storyboard x:Key="Click"> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(FrameworkElement.Width)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(FrameworkElement.Height)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(UIElement.Opacity)"> <EasingDoubleKeyFrame KeyTime="0" Value="0.3" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Viewbox Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:RadioButtonAssist.RadioButtonSize)}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:RadioButtonAssist.RadioButtonSize)}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <Canvas Width="24" Height="24"> <Path x:Name="Graphic" Data="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" Fill="{DynamicResource MaterialDesign.Brush.RadioButton.Outline}" /> <Ellipse x:Name="InteractionEllipse" Canvas.Left="12" Canvas.Top="12" IsHitTestVisible="False" Width="0" Height="0" Fill="{TemplateBinding Foreground}" Opacity="0" RenderTransformOrigin="0.5,0.5"> <Ellipse.RenderTransform> <TransformGroup> <ScaleTransform /> <SkewTransform /> <RotateTransform /> <TranslateTransform /> </TransformGroup> </Ellipse.RenderTransform> </Ellipse> </Canvas> </Viewbox> <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="False" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </Grid> <ControlTemplate.Triggers> <EventTrigger RoutedEvent="ButtonBase.Click"> <BeginStoryboard Storyboard="{StaticResource Click}" /> </EventTrigger> <Trigger Property="HasContent" Value="true"> <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}" /> <Setter Property="Padding" Value="4,2,0,0" /> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Opacity" Value="0.26" /> <Setter TargetName="Graphic" Property="Fill" Value="{DynamicResource MaterialDesign.Brush.RadioButton.Disabled}" /> </Trigger> <Trigger Property="IsPressed" Value="true" /> <Trigger Property="IsChecked" Value="true"> <Setter TargetName="Graphic" Property="Data" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" /> <Setter TargetName="Graphic" Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" /> </Trigger> <Trigger Property="IsChecked" Value="{x:Null}"> <Setter TargetName="Graphic" Property="Data" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" /> <Setter TargetName="Graphic" Property="Opacity" Value="0.56" /> </Trigger> <Trigger Property="Validation.HasError" Value="true"> <Setter TargetName="Graphic" Property="Fill" Value="{DynamicResource MaterialDesign.Brush.ValidationError}" /> <Setter TargetName="contentPresenter" Property="Control.Foreground" Value="{DynamicResource MaterialDesign.Brush.ValidationError}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}" /> <Setter Property="VerticalContentAlignment" Value="Center" /> </Style> <Style x:Key="MaterialDesignLightRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> </Style> <Style x:Key="MaterialDesignDarkRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> </Style> <Style x:Key="MaterialDesignSecondaryRadioButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignRadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> </Style> <Style x:Key="MaterialDesignUserForegroundRadioButton" TargetType="{x:Type RadioButton}"> <Setter Property="BorderThickness" Value="1" /> <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" /> <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <ControlTemplate.Resources> <Storyboard x:Key="Click"> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(FrameworkElement.Width)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(FrameworkElement.Height)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="48" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> <EasingDoubleKeyFrame KeyTime="0" Value="0" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="-24" /> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="InteractionEllipse" Storyboard.TargetProperty="(UIElement.Opacity)"> <EasingDoubleKeyFrame KeyTime="0" Value="0.3" /> <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Viewbox Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:RadioButtonAssist.RadioButtonSize)}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:RadioButtonAssist.RadioButtonSize)}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <Canvas Width="24" Height="24"> <Path x:Name="Graphic" Data="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" Fill="{TemplateBinding Foreground}" /> <Ellipse x:Name="InteractionEllipse" Canvas.Left="12" Canvas.Top="12" IsHitTestVisible="False" Width="0" Height="0" Fill="{TemplateBinding Foreground}" Opacity="0" RenderTransformOrigin="0.5,0.5"> <Ellipse.RenderTransform> <TransformGroup> <ScaleTransform /> <SkewTransform /> <RotateTransform /> <TranslateTransform /> </TransformGroup> </Ellipse.RenderTransform> </Ellipse> </Canvas> </Viewbox> <ContentPresenter x:Name="contentPresenter" Grid.Column="1" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="False" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </Grid> <ControlTemplate.Triggers> <EventTrigger RoutedEvent="ButtonBase.Click"> <BeginStoryboard Storyboard="{StaticResource Click}" /> </EventTrigger> <Trigger Property="HasContent" Value="true"> <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}" /> <Setter Property="Padding" Value="4,2,0,0" /> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Opacity" Value="0.26" /> </Trigger> <Trigger Property="IsPressed" Value="true" /> <Trigger Property="IsChecked" Value="true"> <Setter TargetName="Graphic" Property="Data" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" /> </Trigger> <Trigger Property="IsChecked" Value="{x:Null}"> <Setter TargetName="Graphic" Property="Data" Value="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" /> <Setter TargetName="Graphic" Property="Opacity" Value="0.56" /> </Trigger> <Trigger Property="Validation.HasError" Value="true"> <Setter TargetName="Graphic" Property="Fill" Value="{DynamicResource MaterialDesign.Brush.ValidationError}" /> <Setter TargetName="contentPresenter" Property="Control.Foreground" Value="{DynamicResource MaterialDesign.Brush.ValidationError}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}" /> <Setter Property="VerticalContentAlignment" Value="Center" /> </Style> <Style x:Key="MaterialDesignTabRadioButton" TargetType="{x:Type RadioButton}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <Setter Property="BorderThickness" Value="0,0,0,2" /> <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" /> <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="MinHeight" Value="32" /> <Setter Property="MinWidth" Value="80" /> <Setter Property="Padding" Value="16,4,16,4" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <Grid SnapsToDevicePixels="true"> <ProgressBar x:Name="ProgressBar" Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ButtonBase}}, Path=ActualWidth}" Height="{TemplateBinding Height}" HorizontalAlignment="Left" VerticalAlignment="Center" Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.IndicatorBackground)}" BorderThickness="0" Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.IndicatorForeground)}" IsIndeterminate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.IsIndeterminate)}" Maximum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.Maximum)}" Minimum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.Minimum)}" Opacity="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.Opacity)}" Style="{DynamicResource MaterialDesignLinearProgressBar}" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.IsIndicatorVisible), Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ButtonProgressAssist.Value)}" /> <Border Margin="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <wpf:Ripple x:Name="contentPresenter" Padding="{TemplateBinding Padding}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Focusable="False" Opacity=".82" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </Border> <Border x:Name="SelectionHighlightBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Visibility="Hidden" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="SelectionHighlightBorder" Property="Visibility" Value="Visible" /> <Setter TargetName="contentPresenter" Property="Opacity" Value="1" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value="0.38" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="TextBlock.FontSize" Value="14" /> <Setter Property="TextBlock.FontWeight" Value="Medium" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="wpf:ButtonProgressAssist.IndicatorBackground" Value="Transparent" /> <Setter Property="wpf:ButtonProgressAssist.IndicatorForeground" Value="{DynamicResource MaterialDesign.Brush.RadioButton.Checked}" /> <Setter Property="wpf:ButtonProgressAssist.IsIndicatorVisible" Value="False" /> <Setter Property="wpf:ButtonProgressAssist.Opacity" Value=".4" /> <Setter Property="wpf:RippleAssist.Feedback" Value="{DynamicResource MaterialDesign.Brush.Button.Ripple}" /> <Style.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter Property="Foreground" Value="{Binding BorderBrush, RelativeSource={RelativeSource Mode=Self}}" /> </Trigger> </Style.Triggers> </Style> <Style x:Key="MaterialDesignTabRadioButtonLeft" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignTabRadioButton}"> <Setter Property="BorderThickness" Value="2,0,0,0" /> </Style> <Style x:Key="MaterialDesignTabRadioButtonTop" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignTabRadioButton}"> <Setter Property="BorderThickness" Value="0,2,0,0" /> </Style> <Style x:Key="MaterialDesignTabRadioButtonRight" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignTabRadioButton}"> <Setter Property="BorderThickness" Value="0,0,2,0" /> </Style> <Style x:Key="MaterialDesignTabRadioButtonBottom" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource MaterialDesignTabRadioButton}"> <Setter Property="BorderThickness" Value="0,0,0,2" /> </Style> <Style x:Key="MaterialDesignToolRadioButton" TargetType="{x:Type RadioButton}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.RadioButton.Border}" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="Padding" Value="14,6,14,6" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <Border Margin="{TemplateBinding Margin}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ClipToBounds="{TemplateBinding ClipToBounds}"> <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="CommonStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.3" To="Normal"> <VisualTransition.GeneratedEasingFunction> <CircleEase EasingMode="EaseOut" /> </VisualTransition.GeneratedEasingFunction> </VisualTransition> </VisualStateGroup.Transitions> <VisualState Name="Normal" /> <VisualState Name="MouseOver"> <Storyboard> <DoubleAnimation Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="Opacity" To="0.1" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Disabled" /> </VisualStateGroup> <VisualStateGroup Name="CheckedStates"> <VisualStateGroup.Transitions> <VisualTransition From="*" To="Checked"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckedBackgroundBorder" Storyboard.TargetProperty="Opacity"> <EasingDoubleKeyFrame KeyTime="0" Value="1" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualTransition> <VisualTransition From="*" To="CheckedUnfocused"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckedBackgroundBorder" Storyboard.TargetProperty="Opacity"> <EasingDoubleKeyFrame KeyTime="0" Value="1" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualTransition> <VisualTransition From="Checked" To="Unchecked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="CheckedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0" /> </Storyboard> </VisualTransition> </VisualStateGroup.Transitions> <VisualState Name="Checked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="CheckedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> <DoubleAnimation Storyboard.TargetName="CheckedBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unchecked" /> <VisualState Name="CheckedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="CheckedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> <DoubleAnimation Storyboard.TargetName="CheckedBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid> <Border x:Name="MouseOverBorder" Background="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}" Opacity="0" /> <Border x:Name="CheckedBackgroundBorder" Background="{DynamicResource MaterialDesign.Brush.RadioButton.Checked}" Opacity="0" /> <wpf:Ripple x:Name="Ripple" Padding="{TemplateBinding Padding}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" Feedback="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}" Focusable="False" Opacity=".56" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> <Border x:Name="CheckedBorder" BorderBrush="{DynamicResource MaterialDesign.Brush.RadioButton.Checked}" BorderThickness="0" Opacity="0" Visibility="{TemplateBinding IsChecked, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}" /> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="Ripple" Property="Opacity" Value=".92" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value=".56" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}" /> <Setter Property="VerticalAlignment" Value="Stretch" /> </Style> <Style x:Key="MaterialDesignChoiceChipRadioButton" TargetType="{x:Type ToggleButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Cursor" Value="Hand" /> <Setter Property="FontSize" Value="13" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="Height" Value="32" /> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="Margin" Value="4" /> <Setter Property="MinWidth" Value="46" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToggleButton}"> <ControlTemplate.Resources> <Style TargetType="{x:Type wpf:PackIcon}"> <Setter Property="FrameworkElement.Height" Value="22" /> <Setter Property="FrameworkElement.Width" Value="22" /> </Style> </ControlTemplate.Resources> <Grid ClipToBounds="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="CommonStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.3" To="Normal"> <VisualTransition.GeneratedEasingFunction> <CircleEase EasingMode="EaseOut" /> </VisualTransition.GeneratedEasingFunction> </VisualTransition> </VisualStateGroup.Transitions> <VisualState Name="Normal" /> <VisualState Name="MouseOver"> <Storyboard> <DoubleAnimation Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="Opacity" To="0.1" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Disabled" /> </VisualStateGroup> <VisualStateGroup Name="CheckStates"> <VisualStateGroup.Transitions> <VisualTransition To="Checked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0:0:0.2" /> </Storyboard> </VisualTransition> <VisualTransition To="CheckedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0:0:0.2" /> </Storyboard> </VisualTransition> <VisualTransition To="Unchecked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2" /> </Storyboard> </VisualTransition> </VisualStateGroup.Transitions> <VisualState Name="Checked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="CheckedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unchecked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Border Grid.ColumnSpan="2" Background="{DynamicResource MaterialDesign.Brush.Chip.Background}" CornerRadius="16" /> <Border x:Name="MouseOverBorder" Grid.Column="0" Grid.ColumnSpan="2" Background="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}" CornerRadius="16" Opacity="0" /> <Border x:Name="SelectedBackgroundBorder" Grid.Column="0" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" CornerRadius="16" Opacity="0" /> <ContentControl x:Name="Content" Grid.Column="1" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" IsTabStop="False" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value=".56" /> </Trigger> <Trigger Property="IsChecked" Value="False"> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.RadioButton.Border}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipOutlineRadioButton" TargetType="{x:Type ToggleButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.ForegroundLight}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Cursor" Value="Hand" /> <Setter Property="FontSize" Value="13" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="Height" Value="32" /> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="Margin" Value="4" /> <Setter Property="MinWidth" Value="46" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToggleButton}"> <ControlTemplate.Resources> <Style TargetType="{x:Type wpf:PackIcon}"> <Setter Property="FrameworkElement.Height" Value="22" /> <Setter Property="FrameworkElement.Width" Value="22" /> </Style> </ControlTemplate.Resources> <Grid ClipToBounds="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="CommonStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.3" To="Normal"> <VisualTransition.GeneratedEasingFunction> <CircleEase EasingMode="EaseOut" /> </VisualTransition.GeneratedEasingFunction> </VisualTransition> </VisualStateGroup.Transitions> <VisualState Name="Normal" /> <VisualState Name="MouseOver"> <Storyboard> <DoubleAnimation Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="Opacity" To="0.1" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Disabled" /> </VisualStateGroup> <VisualStateGroup Name="CheckStates"> <VisualStateGroup.Transitions> <VisualTransition To="Checked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0.3" Duration="0" /> </Storyboard> </VisualTransition> <VisualTransition To="CheckedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0.3" Duration="0" /> </Storyboard> </VisualTransition> <VisualTransition To="Unchecked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.2" /> </Storyboard> </VisualTransition> </VisualStateGroup.Transitions> <VisualState Name="Checked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0" /> <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0.3" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="CheckedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0" /> <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0.3" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unchecked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Border x:Name="Border" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="16" /> <Border x:Name="MouseOverBorder" Grid.Column="0" Grid.ColumnSpan="2" Background="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="16" Opacity="0" /> <Border x:Name="SelectedBackgroundBorder" Grid.Column="0" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="16" Opacity="0" /> <ContentControl x:Name="Content" Grid.Column="1" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" IsTabStop="False" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value=".56" /> </Trigger> <Trigger Property="IsChecked" Value="False"> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.RadioButton.Chip.CheckedBackground}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipPrimaryRadioButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignChoiceChipRadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="wpf:ThemeAssist.TriggerBrush" Value="{DynamicResource MaterialDesign.Brush.Background}" /> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=(wpf:ThemeAssist.TriggerBrush), RelativeSource={RelativeSource Self}, Converter={x:Static converters:IsDarkConverter.Instance}}" Value="True" /> <Condition Binding="{Binding IsChecked, RelativeSource={RelativeSource Self}}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> </MultiDataTrigger> </Style.Triggers> </Style> <Style x:Key="MaterialDesignChoiceChipSecondaryRadioButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignChoiceChipRadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary.Light}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Dark}" /> <Setter Property="wpf:ThemeAssist.TriggerBrush" Value="{DynamicResource MaterialDesign.Brush.Background}" /> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=(wpf:ThemeAssist.TriggerBrush), RelativeSource={RelativeSource Self}, Converter={x:Static converters:IsDarkConverter.Instance}}" Value="True" /> <Condition Binding="{Binding IsChecked, RelativeSource={RelativeSource Self}}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary.Dark}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Light}" /> </MultiDataTrigger> </Style.Triggers> </Style> <Style x:Key="MaterialDesignChoiceChipPrimaryOutlineRadioButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignChoiceChipOutlineRadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="wpf:ThemeAssist.TriggerBrush" Value="{DynamicResource MaterialDesign.Brush.Background}" /> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=(wpf:ThemeAssist.TriggerBrush), RelativeSource={RelativeSource Self}, Converter={x:Static converters:IsDarkConverter.Instance}}" Value="True" /> <Condition Binding="{Binding IsChecked, RelativeSource={RelativeSource Self}}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> </MultiDataTrigger> </Style.Triggers> </Style> <Style x:Key="MaterialDesignChoiceChipSecondaryOutlineRadioButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignChoiceChipOutlineRadioButton}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary.Light}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Dark}" /> <Setter Property="wpf:ThemeAssist.TriggerBrush" Value="{DynamicResource MaterialDesign.Brush.Background}" /> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding Path=(wpf:ThemeAssist.TriggerBrush), RelativeSource={RelativeSource Self}, Converter={x:Static converters:IsDarkConverter.Instance}}" Value="True" /> <Condition Binding="{Binding IsChecked, RelativeSource={RelativeSource Self}}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary.Dark}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Light}" /> </MultiDataTrigger> </Style.Triggers> </Style> </ResourceDictionary> |