Themes/MaterialDesignTheme.ListBox.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.Shadows.xaml" /> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.CheckBox.xaml" /> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.RadioButton.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> <!--#region ToolToggle--> <Style x:Key="MaterialDesignToolToggleListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.ListBoxItem.Border}" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="Padding" Value="14,6,14,6" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <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.03" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Disabled" /> </VisualStateGroup> <VisualStateGroup Name="SelectionStates"> <VisualStateGroup.Transitions> <VisualTransition From="*" To="Selected"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity"> <EasingDoubleKeyFrame KeyTime="0" Value="1" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualTransition> <VisualTransition From="*" To="SelectedUnfocused"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity"> <EasingDoubleKeyFrame KeyTime="0" Value="1" /> </DoubleAnimationUsingKeyFrames> </Storyboard> </VisualTransition> <VisualTransition From="Selected" To="Unselected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="0" Duration="0" /> </Storyboard> </VisualTransition> </VisualStateGroup.Transitions> <VisualState Name="Selected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> <DoubleAnimation Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unselected" /> <VisualState Name="SelectedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBackgroundBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> <DoubleAnimation Storyboard.TargetName="SelectedBorder" 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="SelectedBackgroundBorder" Background="{DynamicResource MaterialDesign.Brush.ListBoxItem.Selected}" 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="SelectedBorder" BorderBrush="{DynamicResource MaterialDesign.Brush.ListBoxItem.Selected}" BorderThickness="0" Opacity="0" Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListBox}, Path=SelectionMode, Converter={x:Static converters:EqualityToVisibilityConverter.Instance}, ConverterParameter={x:Static SelectionMode.Extended}, Mode=OneWay}" /> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" 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="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> </Style> <Style x:Key="MaterialDesignToolToggleListBox" TargetType="{x:Type ListBox}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.ToolBar.Background}" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignToolToggleListBoxItem}" /> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" /> </ItemsPanelTemplate> </Setter.Value> </Setter> <Setter Property="ScrollViewer.CanContentScroll" Value="true" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> <Setter Property="ScrollViewer.PanningMode" Value="Both" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="Stylus.IsFlicksEnabled" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBox}"> <ControlTemplate.Resources> <Style TargetType="{x:Type wpf:PackIcon}"> <Setter Property="FrameworkElement.Height" Value="22" /> <Setter Property="FrameworkElement.Width" Value="22" /> </Style> </ControlTemplate.Resources> <Border x:Name="Bd" Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> <wpf:Card HorizontalAlignment="{TemplateBinding HorizontalAlignment}" wpf:ElevationAssist.Elevation="{TemplateBinding wpf:ElevationAssist.Elevation}" Background="{TemplateBinding Background}"> <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </wpf:Card> </Border> <ControlTemplate.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsGrouping" Value="true" /> <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> </MultiTrigger.Conditions> <Setter Property="ScrollViewer.CanContentScroll" Value="false" /> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="wpf:ElevationAssist.Elevation" Value="Dp1" /> <Setter Property="wpf:ListBoxAssist.IsToggle" Value="True" /> </Style> <Style x:Key="MaterialDesignToolVerticalToggleListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignToolToggleListBox}"> <Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Vertical" /> </ItemsPanelTemplate> </Setter.Value> </Setter> <Setter Property="VerticalAlignment" Value="Top" /> </Style> <Style x:Key="MaterialDesignToolToggleFlatListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignToolToggleListBox}"> <Setter Property="wpf:ElevationAssist.Elevation" Value="Dp0" /> </Style> <!--#endregion--> <!--#region Default--> <Style x:Key="MaterialDesignListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="Padding" Value="8" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="wpf:ListBoxItemAssist.HoverBackground" Value="{Binding Foreground, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BrushOpacityConverter.Instance}, ConverterParameter=0.1}" /> <Setter Property="wpf:ListBoxItemAssist.SelectedFocusedBackground" Value="{Binding Foreground, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BrushOpacityConverter.Instance}, ConverterParameter=0.18}" /> <Setter Property="wpf:ListBoxItemAssist.SelectedUnfocusedBackground" Value="{Binding Foreground, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BrushOpacityConverter.Instance}, ConverterParameter=0.09}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <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="1" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Disabled" /> </VisualStateGroup> <VisualStateGroup Name="SelectionStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.6" /> </VisualStateGroup.Transitions> <VisualState Name="Selected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unselected" /> <VisualState Name="SelectedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedUnfocusedBorder" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid> <Border x:Name="MouseOverBorder" Background="{Binding Path=(wpf:ListBoxItemAssist.HoverBackground), RelativeSource={RelativeSource TemplatedParent}}" Opacity="0" /> <Border x:Name="SelectedBorder" Background="{Binding Path=(wpf:ListBoxItemAssist.SelectedFocusedBackground), RelativeSource={RelativeSource TemplatedParent}}" Opacity="0" /> <Border x:Name="SelectedUnfocusedBorder" Background="{Binding Path=(wpf:ListBoxItemAssist.SelectedUnfocusedBackground), RelativeSource={RelativeSource TemplatedParent}}" 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" RecognizesAccessKey="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value=".56" /> </Trigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ListBoxItemAssist.ShowSelection)}" Value="False"> <Setter TargetName="MouseOverBorder" Property="Visibility" Value="Collapsed" /> <Setter TargetName="Ripple" Property="Feedback" Value="Transparent" /> <Setter TargetName="SelectedBorder" Property="Visibility" Value="Collapsed" /> <Setter TargetName="SelectedUnfocusedBorder" Property="Visibility" Value="Collapsed" /> </DataTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="wpf:ListBoxItemAssist.ShowSelection" Value="{Binding Path=(wpf:ListBoxItemAssist.ShowSelection), RelativeSource={RelativeSource AncestorType=ListBox}}" /> </Style> <Style x:Key="MaterialDesignListBox" TargetType="{x:Type ListBox}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignListBoxItem}" /> <Setter Property="ScrollViewer.CanContentScroll" Value="true" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> <Setter Property="ScrollViewer.PanningMode" Value="Both" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="Stylus.IsFlicksEnabled" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBox}"> <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ClipToBounds="False" SnapsToDevicePixels="true"> <ScrollViewer Padding="{TemplateBinding Padding}" wpf:ScrollViewerAssist.IgnorePadding="{Binding Path=(wpf:ScrollViewerAssist.IgnorePadding), RelativeSource={RelativeSource TemplatedParent}}" wpf:ScrollViewerAssist.PaddingMode="{Binding Path=(wpf:ScrollViewerAssist.PaddingMode), RelativeSource={RelativeSource TemplatedParent}}" ClipToBounds="False" Focusable="false"> <ItemsPresenter ClipToBounds="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </ScrollViewer> </Border> <ControlTemplate.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsGrouping" Value="true" /> <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> </MultiTrigger.Conditions> <Setter Property="ScrollViewer.CanContentScroll" Value="false" /> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="wpf:ScrollViewerAssist.IsAutoHideEnabled" Value="True" /> </Style> <!--#endregion--> <!--#region Cards--> <Style x:Key="MaterialDesignCardsListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="White" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" /> <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="Margin" Value="0,0,8,8" /> <Setter Property="Padding" Value="0" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <wpf:Card Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" /> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> </Style> <Style x:Key="MaterialDesignCardsListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignCardsListBoxItem}" /> </Style> <!--#endregion--> <!--#region Navigation--> <Style x:Key="MaterialDesignNavigationListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="FontWeight" Value="Medium" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="Margin" Value="4,2,4,2" /> <Setter Property="Padding" Value="8" /> <Setter Property="SnapsToDevicePixels" Value="True" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Border x:Name="border" Margin="{TemplateBinding Margin}" ClipToBounds="{TemplateBinding ClipToBounds}" CornerRadius="{Binding Path=(wpf:ListBoxItemAssist.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"> <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="SelectionStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.6" /> </VisualStateGroup.Transitions> <VisualState Name="Selected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Opacity" To="0.12" Duration="0" /> </Storyboard> </VisualState> <VisualState Name="Unselected" /> <VisualState Name="SelectedUnfocused"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Opacity" To="0.12" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid> <Grid.Clip> <MultiBinding Converter="{x:Static converters:BorderClipConverter.Instance}"> <Binding ElementName="border" Path="ActualWidth" /> <Binding ElementName="border" Path="ActualHeight" /> <Binding ElementName="border" Path="CornerRadius" /> <Binding ElementName="border" Path="BorderThickness" /> </MultiBinding> </Grid.Clip> <Border x:Name="MouseOverBorder" Background="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}" Opacity="0" /> <Border x:Name="SelectedBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0" /> <wpf: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" RecognizesAccessKey="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value=".56" /> </Trigger> <Trigger Property="IsSelected" Value="False"> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="wpf:ListBoxItemAssist.CornerRadius" Value="4" /> <Setter Property="wpf:ThemeAssist.TriggerBrush" Value="{DynamicResource MaterialDesign.Brush.Background}" /> </Style> <Style x:Key="MaterialDesignNavigationPrimaryListBoxItem" TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource MaterialDesignNavigationListBoxItem}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> <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 IsSelected, RelativeSource={RelativeSource Self}}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> </MultiDataTrigger> </Style.Triggers> </Style> <Style x:Key="MaterialDesignNavigationSecondaryListBoxItem" TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource MaterialDesignNavigationListBoxItem}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary}" /> <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 IsSelected, RelativeSource={RelativeSource Self}}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Secondary.Light}" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Light}" /> </MultiDataTrigger> </Style.Triggers> </Style> <Style x:Key="MaterialDesignNavigationListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignNavigationListBoxItem}" /> </Style> <Style x:Key="MaterialDesignNavigationPrimaryListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignNavigationPrimaryListBoxItem}" /> </Style> <Style x:Key="MaterialDesignNavigationSecondaryListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignNavigationSecondaryListBoxItem}" /> </Style> <!--#endregion--> <!--#region Filter Chip--> <Style x:Key="MaterialDesignFilterChipListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <CheckBox Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignFilterChipCheckBox}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipListBox" TargetType="{x:Type ListBox}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" /> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignFilterChipListBoxItem}" /> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <WrapPanel Orientation="Horizontal" /> </ItemsPanelTemplate> </Setter.Value> </Setter> <Setter Property="ScrollViewer.CanContentScroll" Value="true" /> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" /> <Setter Property="ScrollViewer.PanningMode" Value="Both" /> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> <Setter Property="SelectionMode" Value="Multiple" /> <Setter Property="Stylus.IsFlicksEnabled" Value="False" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBox}"> <ControlTemplate.Resources> <Style TargetType="{x:Type wpf:PackIcon}"> <Setter Property="FrameworkElement.Height" Value="22" /> <Setter Property="FrameworkElement.Width" Value="22" /> </Style> </ControlTemplate.Resources> <Border x:Name="Bd" Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> <ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false" wpf:ScrollViewerAssist.IgnorePadding="{Binding Path=(wpf:ScrollViewerAssist.IgnorePadding), RelativeSource={RelativeSource TemplatedParent}}" wpf:ScrollViewerAssist.PaddingMode="{Binding Path=(wpf:ScrollViewerAssist.PaddingMode), RelativeSource={RelativeSource TemplatedParent}}"> <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> </ScrollViewer> </Border> <ControlTemplate.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsGrouping" Value="true" /> <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> </MultiTrigger.Conditions> <Setter Property="ScrollViewer.CanContentScroll" Value="false" /> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="VerticalContentAlignment" Value="Center" /> </Style> <Style x:Key="MaterialDesignFilterChipPrimaryListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <CheckBox Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignFilterChipPrimaryCheckBox}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipPrimaryListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignFilterChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignFilterChipPrimaryListBoxItem}" /> </Style> <Style x:Key="MaterialDesignFilterChipSecondaryListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <CheckBox Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignFilterChipSecondaryCheckBox}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipSecondaryListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignFilterChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignFilterChipSecondaryListBoxItem}" /> </Style> <Style x:Key="MaterialDesignFilterChipOutlineListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <CheckBox Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignFilterChipOutlineCheckBox}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipOutlineListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignFilterChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignFilterChipOutlineListBoxItem}" /> </Style> <Style x:Key="MaterialDesignFilterChipPrimaryOutlineListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <CheckBox Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignFilterChipPrimaryOutlineCheckBox}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipPrimaryOutlineListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignFilterChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignFilterChipPrimaryOutlineListBoxItem}" /> </Style> <Style x:Key="MaterialDesignFilterChipSecondaryOutlineListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <CheckBox Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignFilterChipSecondaryOutlineCheckBox}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignFilterChipSecondaryOutlineListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignFilterChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignFilterChipSecondaryOutlineListBoxItem}" /> </Style> <!--#endregion--> <!--#region Choice Chip--> <Style x:Key="MaterialDesignChoiceChipListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <RadioButton Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" GroupName="{Binding RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignChoiceChipRadioButton}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignFilterChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignChoiceChipListBoxItem}" /> <Setter Property="SelectionMode" Value="Single" /> </Style> <Style x:Key="MaterialDesignChoiceChipPrimaryListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <RadioButton Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" GroupName="{Binding Name, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignChoiceChipPrimaryRadioButton}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipPrimaryListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignChoiceChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignChoiceChipPrimaryListBoxItem}" /> </Style> <Style x:Key="MaterialDesignChoiceChipSecondaryListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <RadioButton Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" GroupName="{Binding Name, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignChoiceChipSecondaryRadioButton}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipSecondaryListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignChoiceChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignChoiceChipSecondaryListBoxItem}" /> </Style> <Style x:Key="MaterialDesignChoiceChipOutlineListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <RadioButton Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" GroupName="{Binding Name, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignChoiceChipOutlineRadioButton}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipOutlineListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignChoiceChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignChoiceChipOutlineListBoxItem}" /> </Style> <Style x:Key="MaterialDesignChoiceChipPrimaryOutlineListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <RadioButton Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" GroupName="{Binding Name, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignChoiceChipPrimaryOutlineRadioButton}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipPrimaryOutlineListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignChoiceChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignChoiceChipPrimaryOutlineListBoxItem}" /> </Style> <Style x:Key="MaterialDesignChoiceChipSecondaryOutlineListBoxItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <RadioButton Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentTemplateSelector}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" FontStyle="{TemplateBinding FontStyle}" FontWeight="{TemplateBinding FontWeight}" GroupName="{Binding Name, RelativeSource={RelativeSource AncestorType={x:Type ListBox}}}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" Style="{StaticResource MaterialDesignChoiceChipSecondaryOutlineRadioButton}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MaterialDesignChoiceChipSecondaryOutlineListBox" TargetType="{x:Type ListBox}" BasedOn="{StaticResource MaterialDesignChoiceChipListBox}"> <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignChoiceChipSecondaryOutlineListBoxItem}" /> </Style> <!--#endregion--> </ResourceDictionary> |