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