123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:hc="clr-namespace:HandyControl.Controls">
- <Style x:Key="SideMenuItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="hc:SideMenuItem">
- <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0Margin0}"/>
- <Setter Property="Role" Value="Item"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
- <Setter Property="MinHeight" Value="40"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="hc:SideMenuItem">
- <Border Name="BorderRoot" Background="{TemplateBinding Background}">
- <hc:SimplePanel>
- <Rectangle Width="4" Fill="{TemplateBinding BorderBrush}" HorizontalAlignment="Left"/>
- <ContentControl Margin="4,0,0,0">
- <DockPanel Margin="{TemplateBinding Padding}">
- <ContentControl Width="40" Name="PresenterIcon">
- <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </ContentControl>
- <ContentPresenter Name="PresenterHeader" ContentSource="Header" Margin="6,0,0,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
- </DockPanel>
- </ContentControl>
- </hc:SimplePanel>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="Icon" Value="{x:Null}">
- <Setter TargetName="PresenterIcon" Property="Visibility" Value="Collapsed"/>
- </Trigger>
- <DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=hc:SideMenuItem}}" Value="True">
- <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
- </DataTrigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
- <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
- <Setter Property="TextElement.FontWeight" Value="Bold" TargetName="PresenterHeader"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="SideMenuItemAccordionBaseStyle" BasedOn="{StaticResource SideMenuItemBaseStyle}" TargetType="hc:SideMenuItem">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="hc:SideMenuItem">
- <Border Name="BorderRoot" Background="{TemplateBinding Background}">
- <hc:SimplePanel>
- <Rectangle Width="4" Fill="{TemplateBinding BorderBrush}" HorizontalAlignment="Left"/>
- <ContentControl Margin="4,0,0,0">
- <DockPanel Margin="{TemplateBinding Padding}">
- <ContentControl Width="40" Name="PresenterIcon">
- <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </ContentControl>
- <ContentPresenter Name="PresenterHeader" ContentSource="Header" Margin="6,0,0,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
- </DockPanel>
- </ContentControl>
- </hc:SimplePanel>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="Icon" Value="{x:Null}">
- <Setter TargetName="PresenterIcon" Property="Visibility" Value="Collapsed"/>
- </Trigger>
- <DataTrigger Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=hc:SideMenuItem}}" Value="True">
- <Setter Property="BorderBrush" Value="Transparent"/>
- </DataTrigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
- <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
- <Setter Property="TextElement.FontWeight" Value="Bold" TargetName="PresenterHeader"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="SideMenuItemHeaderBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="hc:SideMenuItem">
- <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0Margin0}"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
- <Setter Property="ItemContainerStyle" Value="{StaticResource SideMenuItemBaseStyle}"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="hc:SideMenuItem">
- <Border Name="BorderRoot" Background="{TemplateBinding Background}">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition MinHeight="48"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Border Name="BorderBack" Background="{TemplateBinding Background}"/>
- <ContentControl Grid.Row="0" Margin="4,0,0,0">
- <DockPanel Margin="{TemplateBinding Padding}" Name="PanelHeader" Background="Transparent">
- <ContentControl Width="40" Name="PresenterIcon">
- <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </ContentControl>
- <ContentPresenter Name="PresenterHeader" ContentSource="Header" Margin="6,0,0,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
- </DockPanel>
- </ContentControl>
- <StackPanel Grid.Row="1" x:Name="PART_Panel" Visibility="Collapsed" Height="{Binding PanelAreaLength,RelativeSource={RelativeSource AncestorType=hc:SideMenu}}"/>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="Icon" Value="{x:Null}">
- <Setter TargetName="PresenterIcon" Property="Visibility" Value="Collapsed"/>
- </Trigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter TargetName="BorderBack" Property="BorderThickness" Value="4,0,0,0"/>
- <Setter TargetName="BorderBack" Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
- <Setter Property="TextElement.FontWeight" Value="Bold" TargetName="PresenterHeader"/>
- </Trigger>
- <Trigger SourceName="PanelHeader" Property="IsMouseOver" Value="true">
- <Setter TargetName="BorderBack" Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="SideMenuItemHeaderAccordionBaseStyle" BasedOn="{StaticResource SideMenuItemHeaderBaseStyle}" TargetType="hc:SideMenuItem">
- <Setter Property="ItemContainerStyle" Value="{StaticResource SideMenuItemAccordionBaseStyle}"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="hc:SideMenuItem">
- <Border Name="BorderRoot" Background="{TemplateBinding Background}">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition MinHeight="48"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Border Name="BorderBack" Background="{TemplateBinding Background}"/>
- <ContentControl Grid.Row="0" Margin="4,0,0,0">
- <DockPanel Margin="{TemplateBinding Padding}" Name="PanelHeader" Background="Transparent">
- <ContentControl Width="40" Name="PresenterIcon">
- <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </ContentControl>
- <ContentPresenter Name="PresenterHeader" ContentSource="Header" Margin="6,0,0,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
- </DockPanel>
- </ContentControl>
- <ScrollViewer Visibility="{Binding Visibility,ElementName=PART_Panel}" Grid.Row="1" Height="{Binding PanelAreaLength,RelativeSource={RelativeSource AncestorType=hc:SideMenu}}">
- <StackPanel x:Name="PART_Panel" Visibility="Collapsed"/>
- </ScrollViewer>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="Icon" Value="{x:Null}">
- <Setter TargetName="PresenterIcon" Property="Visibility" Value="Collapsed"/>
- </Trigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter TargetName="BorderBack" Property="BorderThickness" Value="4,0,0,0"/>
- <Setter TargetName="BorderBack" Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
- <Setter Property="TextElement.FontWeight" Value="Bold" TargetName="PresenterHeader"/>
- </Trigger>
- <Trigger SourceName="PanelHeader" Property="IsMouseOver" Value="true">
- <Setter TargetName="BorderBack" Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="SideMenuBaseStyle" TargetType="hc:SideMenu">
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="Focusable" Value="False"/>
- <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
- <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
- <Setter Property="ItemContainerStyle" Value="{StaticResource SideMenuItemHeaderBaseStyle}"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="hc:SideMenu">
- <Border Name="BorderRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
- <ScrollViewer>
- <StackPanel x:Name="PART_Panel"/>
- </ScrollViewer>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|