Themes/MaterialDesign3.NavigationDrawer.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"> <Style x:Key="MaterialDesign3.NavigationDrawerListBoxItem" 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="Height" Value="56" /> <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="Margin" Value="0" /> <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:NavigationDrawerAssist.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="Stretch" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" Feedback="{TemplateBinding Foreground, Converter={x:Static converters:BrushRoundConverter.Instance}}" Focusable="False" RecognizesAccessKey="False" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"> <DockPanel Margin="16,0,24,0" LastChildFill="False"> <Grid x:Name="IconContainer" Grid.RowSpan="1" HorizontalAlignment="Left" VerticalAlignment="Center" DockPanel.Dock="Left"> <wpf:PackIcon x:Name="Icon" Width="{Binding Path=(wpf:NavigationDrawerAssist.IconSize), RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(wpf:NavigationDrawerAssist.IconSize), RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center" VerticalAlignment="Center" Kind="{Binding Path=(wpf:NavigationDrawerAssist.SelectedIcon), RelativeSource={RelativeSource TemplatedParent}}" /> </Grid> <ContentControl x:Name="Text" Grid.Row="1" Margin="12,0,0,0" Padding="0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" DockPanel.Dock="Left" /> <ContentControl VerticalAlignment="Center" Content="{Binding Path=(wpf:BadgedAssist.Badge), RelativeSource={RelativeSource TemplatedParent}}" DockPanel.Dock="Right" /> </DockPanel> </wpf:Ripple> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" Value=".56" /> </Trigger> <Trigger Property="IsSelected" Value="False"> <Setter TargetName="Icon" Property="Kind" Value="{Binding Path=(wpf:NavigationDrawerAssist.UnselectedIcon), RelativeSource={RelativeSource TemplatedParent}}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" /> <Setter Property="Width" Value="360" /> <Setter Property="wpf:NavigationDrawerAssist.CornerRadius" Value="26" /> <Setter Property="wpf:NavigationDrawerAssist.IconSize" Value="24" /> <Setter Property="wpf:NavigationDrawerAssist.SelectedIcon" Value="Circle" /> <Setter Property="wpf:NavigationDrawerAssist.UnselectedIcon" Value="CircleOutline" /> <Setter Property="wpf:ThemeAssist.TriggerBrush" Value="{DynamicResource MaterialDesign.Brush.Background}" /> </Style> <Style x:Key="MaterialDesign3.NavigationDrawerPrimaryListBoxItem" TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource MaterialDesign3.NavigationDrawerListBoxItem}"> <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" /> <Setter Property="wpf:ThemeAssist.TriggerBrush" Value="{DynamicResource MaterialDesign.Brush.Background}" /> </Style> </ResourceDictionary> |