268 lines
15 KiB
XML
268 lines
15 KiB
XML
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:controls="clr-namespace:Melskin.Controls"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="FlattenButton.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
<Style
|
|
BasedOn="{StaticResource FlattenButtonStyle}"
|
|
TargetType="{x:Type Button}"
|
|
x:Key="{x:Static ToolBar.ButtonStyleKey}">
|
|
<Setter Property="Padding" Value="4,2" />
|
|
<Setter Property="Margin" Value="1,2" />
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
</Style>
|
|
|
|
<!-- 除展开按钮外的面板 -->
|
|
<Style TargetType="{x:Type Border}" x:Key="ToolBarMainPanelBorderStyle">
|
|
<Setter Property="Margin" Value="0,0,10,0" />
|
|
<Setter Property="CornerRadius" Value="4" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
|
|
<Setter Property="CornerRadius" Value="0" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<!-- 前端拖拽指示 -->
|
|
<Style TargetType="{x:Type Thumb}" x:Key="ToolBarThumbStyle">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type Thumb}">
|
|
<Border
|
|
Background="Transparent"
|
|
Padding="{TemplateBinding Padding}"
|
|
SnapsToDevicePixels="True">
|
|
<Border Background="{DynamicResource BorderNormalBrush}" CornerRadius="1" />
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
<Setter Property="Cursor" Value="SizeAll" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<!-- 水平展开按钮 -->
|
|
<Style TargetType="{x:Type ToggleButton}" x:Key="ToolBarHorizontalOverflowButtonStyle">
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="MinHeight" Value="0" />
|
|
<Setter Property="MinWidth" Value="0" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
CornerRadius="0,4,4,0"
|
|
SnapsToDevicePixels="true"
|
|
Width="10"
|
|
x:Name="Bd">
|
|
|
|
<Grid Margin="1,2,3,1" VerticalAlignment="Bottom">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="4" />
|
|
<RowDefinition Height="4" />
|
|
</Grid.RowDefinitions>
|
|
<Rectangle Fill="{TemplateBinding Foreground}" Height="1" />
|
|
<controls:IconElement
|
|
Foreground="{TemplateBinding Foreground}"
|
|
Grid.Row="1"
|
|
Symbol="ArrowDropDown" />
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsKeyboardFocused" Value="true">
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource BackgroundFloatingBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
|
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<!-- 垂直展开按钮 -->
|
|
<Style TargetType="{x:Type ToggleButton}" x:Key="ToolBarVerticalOverflowButtonStyle">
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
|
<Setter Property="MinHeight" Value="0" />
|
|
<Setter Property="MinWidth" Value="0" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
CornerRadius="0,0,4,4"
|
|
SnapsToDevicePixels="true"
|
|
x:Name="Bd">
|
|
<Grid
|
|
HorizontalAlignment="Right"
|
|
Margin="4"
|
|
Width="4">
|
|
<controls:IconElement
|
|
Foreground="{TemplateBinding Foreground}"
|
|
Grid.Column="1"
|
|
Symbol="ArrowRight" />
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="true">
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsKeyboardFocused" Value="true">
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource BackgroundFloatingBrush}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
|
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type ToolBar}">
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ToolBar}">
|
|
<Grid
|
|
Margin="4,2,2,2"
|
|
SnapsToDevicePixels="true"
|
|
x:Name="Grid">
|
|
<Grid HorizontalAlignment="Right" x:Name="OverflowGrid">
|
|
<!-- 展开按钮 -->
|
|
<ToggleButton
|
|
ClickMode="Press"
|
|
FocusVisualStyle="{x:Null}"
|
|
IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
IsEnabled="{TemplateBinding HasOverflowItems}"
|
|
Style="{StaticResource ToolBarHorizontalOverflowButtonStyle}"
|
|
x:Name="OverflowButton" />
|
|
<Popup
|
|
AllowsTransparency="true"
|
|
Focusable="false"
|
|
IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
|
Placement="Bottom"
|
|
PopupAnimation="None"
|
|
StaysOpen="false"
|
|
x:Name="OverflowPopup">
|
|
<Border
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
|
BorderThickness="0"
|
|
CornerRadius="4"
|
|
Effect="{DynamicResource PopupShadow}"
|
|
Margin="8"
|
|
RenderOptions.ClearTypeHint="Enabled"
|
|
x:Name="ToolBarSubMenuBorder">
|
|
<ToolBarOverflowPanel
|
|
FocusVisualStyle="{x:Null}"
|
|
Focusable="true"
|
|
KeyboardNavigation.DirectionalNavigation="Cycle"
|
|
KeyboardNavigation.TabNavigation="Cycle"
|
|
Margin="4,0"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
WrapWidth="200"
|
|
x:Name="PART_ToolBarOverflowPanel" />
|
|
</Border>
|
|
</Popup>
|
|
</Grid>
|
|
<!-- 工具区域展开按钮除外 -->
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="4,0,0,4"
|
|
Padding="{TemplateBinding Padding}"
|
|
Style="{StaticResource ToolBarMainPanelBorderStyle}"
|
|
x:Name="MainPanelBorder">
|
|
<DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
|
|
<Thumb
|
|
Margin="0"
|
|
Padding="3"
|
|
Style="{StaticResource ToolBarThumbStyle}"
|
|
Width="8"
|
|
x:Name="ToolBarThumb" />
|
|
<ContentPresenter
|
|
ContentSource="Header"
|
|
HorizontalAlignment="Center"
|
|
Margin="4,0"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
VerticalAlignment="Center"
|
|
x:Name="ToolBarHeader" />
|
|
<!-- 菜单项目容器 -->
|
|
<ToolBarPanel
|
|
IsItemsHost="true"
|
|
Margin="0"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
x:Name="PART_ToolBarPanel" />
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
<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>
|
|
<Trigger Property="Orientation" Value="Vertical">
|
|
<Setter Property="CornerRadius" TargetName="MainPanelBorder" Value="4,4,0,0" />
|
|
<Setter Property="Margin" TargetName="Grid" Value="2,4,2,2" />
|
|
<Setter Property="Height" TargetName="ToolBarThumb" Value="8" />
|
|
<Setter Property="Width" TargetName="ToolBarThumb" Value="Auto" />
|
|
<Setter Property="Padding" TargetName="ToolBarThumb" Value="3" />
|
|
<Setter Property="Style" TargetName="OverflowButton" Value="{StaticResource ToolBarVerticalOverflowButtonStyle}" />
|
|
<Setter Property="Margin" TargetName="MainPanelBorder" Value="0,0,0,10" />
|
|
<Setter Property="Margin" TargetName="ToolBarHeader" Value="0,4" />
|
|
<Setter Property="DockPanel.Dock" TargetName="ToolBarThumb" Value="Top" />
|
|
<Setter Property="DockPanel.Dock" TargetName="ToolBarHeader" Value="Top" />
|
|
<Setter Property="HorizontalAlignment" TargetName="OverflowGrid" Value="Stretch" />
|
|
<Setter Property="VerticalAlignment" TargetName="OverflowGrid" Value="Bottom" />
|
|
<Setter Property="Placement" TargetName="OverflowPopup" Value="Right" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
|
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type ToolBarTray}">
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
|
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ResourceDictionary> |