Themes/MaterialDesignTheme.CheckBox.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.ToggleButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ValidationErrorTemplate.xaml" /> </ResourceDictionary.MergedDictionaries> <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="OptionMarkFocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeDashArray="1 2" StrokeThickness="1" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignActionCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignActionToggleButton}" /> <Style x:Key="MaterialDesignActionLightCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignActionCheckBox}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Light.Foreground}" /> </Style> <Style x:Key="MaterialDesignActionDarkCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignActionCheckBox}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark.Foreground}" /> </Style> <Style x:Key="MaterialDesignActionSecondaryCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignActionCheckBox}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Foreground}" /> </Style> <Style x:Key="MaterialDesignCheckBox" TargetType="{x:Type CheckBox}"> <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 CheckBox}"> <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:CheckBoxAssist.CheckBoxSize)}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" FlowDirection="LeftToRight"> <Canvas Width="24" Height="24"> <Path x:Name="Graphic" Data="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z" Fill="{DynamicResource MaterialDesign.Brush.ForegroundLight}" /> <Ellipse x:Name="InteractionEllipse" Canvas.Left="12" Canvas.Top="12" Width="0" Height="0" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" 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> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsPressed}" Value="true" /> <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:RippleAssist.IsDisabled)}" Value="false" /> </MultiDataTrigger.Conditions> <MultiDataTrigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource Click}" /> </MultiDataTrigger.EnterActions> </MultiDataTrigger> <Trigger Property="HasContent" Value="true"> <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}" /> <Setter Property="Padding" Value="4,2,0,0" /> </Trigger> <Trigger Property="IsPressed" Value="true" /> <Trigger Property="IsChecked" Value="true"> <Setter TargetName="Graphic" Property="Data" Value="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" /> <Setter TargetName="Graphic" Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" /> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Opacity" Value="0.56" /> <Setter TargetName="Graphic" Property="Fill" Value="{DynamicResource MaterialDesign.Brush.CheckBox.Disabled}" /> </Trigger> <Trigger Property="IsChecked" Value="{x:Null}"> <Setter TargetName="Graphic" Property="Data" Value="M6,13L6,11L18,11L18,13M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" /> <Setter TargetName="Graphic" Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" /> </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="MaterialDesignLightCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignCheckBox}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> </Style> <Style x:Key="MaterialDesignDarkCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignCheckBox}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" /> </Style> <Style x:Key="MaterialDesignSecondaryCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignCheckBox}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> </Style> <Style x:Key="MaterialDesignUserForegroundCheckBox" TargetType="{x:Type CheckBox}"> <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 CheckBox}"> <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:CheckBoxAssist.CheckBoxSize)}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" FlowDirection="LeftToRight"> <Canvas Width="24" Height="24"> <Path x:Name="Graphic" Data="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z" Fill="{TemplateBinding Foreground}" /> <Ellipse x:Name="InteractionEllipse" Canvas.Left="12" Canvas.Top="12" Width="0" Height="0" Fill="{TemplateBinding Foreground}" IsHitTestVisible="False" 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 TargetName="Graphic" Property="Opacity" Value=".26" /> </Trigger> <Trigger Property="IsPressed" Value="true" /> <Trigger Property="IsChecked" Value="true"> <Setter TargetName="Graphic" Property="Data" Value="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" /> </Trigger> <Trigger Property="IsChecked" Value="{x:Null}"> <Setter TargetName="Graphic" Property="Data" Value="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" /> <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="MaterialDesignFilterChipCheckBox" TargetType="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" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" 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" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" 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" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="-16,0,10,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" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="CheckedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unchecked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="-16,0,10,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" /> <wpf:PackIcon x:Name="IconControl" Grid.Column="0" Width="16" Height="16" Margin="-16,0,0,0" VerticalAlignment="Center" IsTabStop="False" Kind="Check" /> <ContentControl x:Name="Content" Grid.Column="1" Margin="0,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="Background" Value="{DynamicResource MaterialDesign.Brush.Chip.Background}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipOutlineCheckBox" TargetType="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.2" Duration="0" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" 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" /> <DoubleAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="Opacity" To="0.2" Duration="0" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" 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" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="-16,0,10,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.2" Duration="0" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" 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.2" Duration="0" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="4,0,4,0" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unchecked"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0" /> <ThicknessAnimation Storyboard.TargetName="IconControl" Storyboard.TargetProperty="Margin" To="-16,0,10,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" /> <wpf:PackIcon x:Name="IconControl" Grid.Column="0" Width="16" Height="16" Margin="-16,0,0,0" VerticalAlignment="Center" IsTabStop="False" Kind="Check" /> <ContentControl x:Name="Content" Grid.Column="1" Margin="0,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.CheckBox.UncheckedBorder}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipPrimaryCheckBox" TargetType="ToggleButton" BasedOn="{StaticResource MaterialDesignFilterChipCheckBox}"> <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="MaterialDesignFilterChipSecondaryCheckBox" TargetType="ToggleButton" BasedOn="{StaticResource MaterialDesignFilterChipCheckBox}"> <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="MaterialDesignFilterChipPrimaryOutlineCheckBox" TargetType="ToggleButton" BasedOn="{StaticResource MaterialDesignFilterChipOutlineCheckBox}"> <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="MaterialDesignFilterChipSecondaryOutlineCheckBox" TargetType="ToggleButton" BasedOn="{StaticResource MaterialDesignFilterChipOutlineCheckBox}"> <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> |