123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <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="{x:Static ToolBar.SeparatorStyleKey}" TargetType="Separator">
- <Setter Property="Background" Value="{DynamicResource BorderBrush}" />
- <Setter Property="Width" Value="1" />
- </Style>
- <!--Styles for controls in a toolbar.-->
- <Style x:Key="ToolBarTrayBaseStyle" TargetType="ToolBarTray">
- <Setter Property="Background" Value="Transparent" />
- </Style>
- <Style x:Key="{x:Static ToolBar.ButtonStyleKey}" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="Button">
- <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
- <Setter Property="BorderThickness" Value="1" />
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}" />
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Setter Property="Background" Value="{DynamicResource BorderBrush}" />
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style x:Key="{x:Static ToolBar.CheckBoxStyleKey}" BasedOn="{StaticResource CheckBoxBaseStyle}" TargetType="CheckBox" />
- <Style x:Key="{x:Static ToolBar.RadioButtonStyleKey}" BasedOn="{StaticResource RadioButtonBaseStyle}" TargetType="RadioButton" />
- <Style x:Key="{x:Static ToolBar.ComboBoxStyleKey}" BasedOn="{StaticResource ComboBoxBaseStyle}" TargetType="ComboBox" />
- <Style x:Key="{x:Static ToolBar.TextBoxStyleKey}" BasedOn="{StaticResource TextBoxBaseStyle}" TargetType="TextBox" />
- <Style x:Key="{x:Static ToolBar.MenuStyleKey}" BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu" />
- <Style x:Key="{x:Static ToolBar.ToggleButtonStyleKey}" BasedOn="{StaticResource ToggleButtonBaseStyle}" TargetType="ToggleButton">
- <Setter Property="Background" Value="{DynamicResource RegionBrush}" />
- <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
- <Setter Property="BorderThickness" Value="1" />
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}" />
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Setter Property="Background" Value="{DynamicResource BorderBrush}" />
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style x:Key="ToolBarThumbHorizontalStyle" TargetType="Thumb">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Thumb">
- <Border SnapsToDevicePixels="True" Padding="{TemplateBinding Padding}" Background="Transparent">
- <Path Stretch="Uniform" Width="4" Fill="{DynamicResource PrimaryBrush}" Data="{StaticResource DragVerticalGeometry}" SnapsToDevicePixels="True" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Cursor" Value="SizeAll" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ToolBarThumbVerticalStyle" TargetType="Thumb">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Thumb">
- <Border SnapsToDevicePixels="True" Padding="{TemplateBinding Padding}" Background="Transparent">
- <Path Stretch="Uniform" Height="4" Fill="{DynamicResource PrimaryBrush}" Data="{StaticResource DragHorizontalGeometry}" SnapsToDevicePixels="True" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Cursor" Value="SizeAll" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ToolBarOverflowButtonStyle" BasedOn="{StaticResource ToggleButtonIcon}" TargetType="ToggleButton">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="MinHeight" Value="0" />
- <Setter Property="MinWidth" Value="0" />
- <Setter Property="Height" Value="Auto" />
- <Setter Property="Width" Value="Auto" />
- <Setter Property="ClickMode" Value="Press" />
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Background" Value="{DynamicResource BorderBrush}" />
- </Trigger>
- </Style.Triggers>
- </Style>
- <ControlTemplate x:Key="ToolBarVerticalTemplate" TargetType="ToolBar">
- <Border x:Name="MainPanelBorder" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
- <Grid SnapsToDevicePixels="true">
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
- <Thumb x:Name="ToolBarThumb" DockPanel.Dock="Top" Style="{StaticResource ToolBarThumbVerticalStyle}" Height="10" Margin="0 4 0 0" />
- <ContentPresenter x:Name="ToolBarHeader" DockPanel.Dock="Top" ContentSource="Header" HorizontalAlignment="Center" Margin="4 4 4 0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" />
- <ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" />
- </DockPanel>
- <ToggleButton x:Name="ButtonOverflow" Margin="2 0 2 2" Padding="6 4" HorizontalContentAlignment="Right" hc:IconElement.Height="8" hc:IconSwitchElement.GeometrySelected="{StaticResource LeftGeometry}" hc:IconElement.Geometry="{StaticResource RightGeometry}" Style="{StaticResource ToolBarOverflowButtonStyle}" Grid.Row="1" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding HasOverflowItems}" />
- <Popup PlacementTarget="{Binding ElementName=ButtonOverflow}" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Right" StaysOpen="false">
- <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Background="{DynamicResource RegionBrush}" RenderOptions.ClearTypeHint="Enabled">
- <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Cycle" FocusVisualStyle="{x:Null}" Focusable="true" Margin="6" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200" />
- </Border>
- </Popup>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsOverflowOpen" Value="true">
- <Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="false" />
- </Trigger>
- <Trigger Property="Header" Value="{x:Null}">
- <Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed" />
- </Trigger>
- <Trigger Property="ToolBarTray.IsLocked" Value="true">
- <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <ControlTemplate x:Key="ToolBarHorizontalTemplate" TargetType="ToolBar">
- <Border x:Name="MainPanelBorder" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
- <Grid SnapsToDevicePixels="true">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
- <Thumb x:Name="ToolBarThumb" Style="{StaticResource ToolBarThumbHorizontalStyle}" Width="10" Margin="4 0 0 0" />
- <ContentPresenter x:Name="ToolBarHeader" ContentSource="Header" HorizontalAlignment="Center" Margin="4 4 0 4" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" />
- <ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" />
- </DockPanel>
- <ToggleButton x:Name="ButtonOverflow" Margin="0 2 2 2" Padding="4 6" VerticalContentAlignment="Bottom" hc:IconElement.Width="8" hc:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" hc:IconElement.Geometry="{StaticResource DownGeometry}" Style="{StaticResource ToolBarOverflowButtonStyle}" Grid.Column="1" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding HasOverflowItems}" />
- <Popup PlacementTarget="{Binding ElementName=ButtonOverflow}" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="false">
- <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Background="{DynamicResource RegionBrush}" RenderOptions.ClearTypeHint="Enabled">
- <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Cycle" FocusVisualStyle="{x:Null}" Focusable="true" Margin="6" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200" />
- </Border>
- </Popup>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsOverflowOpen" Value="true">
- <Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="false" />
- </Trigger>
- <Trigger Property="Header" Value="{x:Null}">
- <Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed" />
- </Trigger>
- <Trigger Property="ToolBarTray.IsLocked" Value="true">
- <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <Style x:Key="ToolBarBaseStyle" TargetType="ToolBar">
- <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
- <Setter Property="Padding" Value="4" />
- <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
- <Setter Property="Template" Value="{StaticResource ToolBarHorizontalTemplate}" />
- <Style.Triggers>
- <Trigger Property="Orientation" Value="Vertical">
- <Setter Property="Template" Value="{StaticResource ToolBarVerticalTemplate}" />
- </Trigger>
- </Style.Triggers>
- </Style>
- </ResourceDictionary>
|