243 lines
16 KiB
Plaintext
243 lines
16 KiB
Plaintext
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
|
xmlns:controls="clr-namespace:WPFDark.Controls"
|
||
|
|
xmlns:wpf="clr-namespace:WPFDark">
|
||
|
|
<Style x:Key="DropDownToggleButtonStyle" TargetType="{x:Type ToggleButton}">
|
||
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundBrushKey}" />
|
||
|
|
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||
|
|
<ContentPresenter x:Name="ContentPresenter"
|
||
|
|
Margin="{TemplateBinding Padding}"
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonActiveBorderBrushKey}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonActiveForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsPressed" Value="True">
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonPressedBorderBrushKey}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonPressedForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonInactiveBorderBrushKey}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonInactiveForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsChecked" Value="True">
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonInactiveBorderBrushKey}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource AccentForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style x:Key="ComboBoxItemContainerStyle" TargetType="{x:Type ComboBoxItem}">
|
||
|
|
<Setter Property="Background" Value="Transparent" />
|
||
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||
|
|
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
||
|
|
<Border Background="{TemplateBinding Background}"
|
||
|
|
Padding="1"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||
|
|
<ContentPresenter Margin="4,0,0,0" />
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource SubmenuItemBackgroundHighlighted}" />
|
||
|
|
</Trigger>
|
||
|
|
|
||
|
|
<MultiTrigger>
|
||
|
|
<MultiTrigger.Conditions>
|
||
|
|
<Condition Property="IsSelected" Value="True" />
|
||
|
|
</MultiTrigger.Conditions>
|
||
|
|
<Setter Property="Background" Value="{DynamicResource Item.SelectedActive.Background}" />
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedActive.Border}" />
|
||
|
|
</MultiTrigger>
|
||
|
|
|
||
|
|
<MultiTrigger>
|
||
|
|
<MultiTrigger.Conditions>
|
||
|
|
<Condition Property="IsSelected" Value="True" />
|
||
|
|
<Condition Property="IsMouseOver" Value="True" />
|
||
|
|
</MultiTrigger.Conditions>
|
||
|
|
<Setter Property="Background" Value="{DynamicResource Item.SelectedActive.Background.IsMouseOver}" />
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedActive.Border.IsMouseOver}" />
|
||
|
|
</MultiTrigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type ComboBox}">
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
|
||
|
|
<Setter Property="Background" Value="{DynamicResource TextBoxBackgroundBrushKey}" />
|
||
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrushKey}" />
|
||
|
|
<Setter Property="BorderThickness" Value="1" />
|
||
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource TextBoxForegroundBrushKey}" />
|
||
|
|
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItemContainerStyle}" />
|
||
|
|
|
||
|
|
<Setter Property="ItemsPanel">
|
||
|
|
<Setter.Value>
|
||
|
|
<ItemsPanelTemplate>
|
||
|
|
<VirtualizingStackPanel KeyboardNavigation.DirectionalNavigation="Contained" />
|
||
|
|
</ItemsPanelTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ComboBox}">
|
||
|
|
<Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||
|
|
<Border x:Name="border"
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||
|
|
CornerRadius="{x:Static wpf:Boxes.BasicCornerRadius}"
|
||
|
|
Padding="{TemplateBinding Padding}">
|
||
|
|
<Grid Margin="-1">
|
||
|
|
<ToggleButton x:Name="toggleButton"
|
||
|
|
ClickMode="Press"
|
||
|
|
Focusable="False"
|
||
|
|
Foreground="{DynamicResource InactiveForegroundBrushKey}"
|
||
|
|
IsChecked="{Binding IsDropDownOpen,
|
||
|
|
Mode=TwoWay,
|
||
|
|
RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
|
IsTabStop="False"
|
||
|
|
OverridesDefaultStyle="True"
|
||
|
|
Style="{StaticResource DropDownToggleButtonStyle}">
|
||
|
|
<ToggleButton.Template>
|
||
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||
|
|
<Border Background="Transparent">
|
||
|
|
<Path x:Name="Arrow"
|
||
|
|
Width="{x:Static SystemParameters.VerticalScrollBarWidth}"
|
||
|
|
HorizontalAlignment="Right"
|
||
|
|
VerticalAlignment="Center"
|
||
|
|
Data="M 0.0,0.0 L 3.5,4.0 7.0,0.0 z"
|
||
|
|
Fill="{TemplateBinding Foreground}">
|
||
|
|
<Path.RenderTransform>
|
||
|
|
<RotateTransform Angle="0" CenterX="3.5" CenterY="2" />
|
||
|
|
</Path.RenderTransform>
|
||
|
|
</Path>
|
||
|
|
</Border>
|
||
|
|
<!-- 旋转动画 -->
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsChecked" Value="True">
|
||
|
|
<Trigger.EnterActions>
|
||
|
|
<BeginStoryboard>
|
||
|
|
<Storyboard>
|
||
|
|
<DoubleAnimation Duration="0:0:0.2"
|
||
|
|
Storyboard.TargetName="Arrow"
|
||
|
|
Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
|
||
|
|
To="180" />
|
||
|
|
</Storyboard>
|
||
|
|
</BeginStoryboard>
|
||
|
|
</Trigger.EnterActions>
|
||
|
|
<Trigger.ExitActions>
|
||
|
|
<BeginStoryboard>
|
||
|
|
<Storyboard>
|
||
|
|
<DoubleAnimation Duration="0:0:0.2"
|
||
|
|
Storyboard.TargetName="Arrow"
|
||
|
|
Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
|
||
|
|
To="0" />
|
||
|
|
</Storyboard>
|
||
|
|
</BeginStoryboard>
|
||
|
|
</Trigger.ExitActions>
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</ToggleButton.Template>
|
||
|
|
</ToggleButton>
|
||
|
|
|
||
|
|
<ContentPresenter Grid.Column="0"
|
||
|
|
Margin="4.5,2.25,26,2.25"
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
||
|
|
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
||
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
||
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
||
|
|
IsHitTestVisible="False"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||
|
|
<ContentPresenter.Resources>
|
||
|
|
<Style TargetType="{x:Type TextBlock}">
|
||
|
|
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||
|
|
</Style>
|
||
|
|
</ContentPresenter.Resources>
|
||
|
|
</ContentPresenter>
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<Popup x:Name="PART_Popup"
|
||
|
|
MinWidth="{TemplateBinding ActualWidth}"
|
||
|
|
AllowsTransparency="True"
|
||
|
|
Focusable="False"
|
||
|
|
FocusVisualStyle="{x:Null}"
|
||
|
|
HorizontalOffset="-2"
|
||
|
|
IsOpen="{TemplateBinding IsDropDownOpen}"
|
||
|
|
Placement="Bottom"
|
||
|
|
PopupAnimation="None"
|
||
|
|
VerticalOffset="1.0">
|
||
|
|
<controls:BiaClippingBorder x:Name="dropdown"
|
||
|
|
MaxHeight="414"
|
||
|
|
Margin="0,0,3,3"
|
||
|
|
Background="{DynamicResource SubmenuItemBackground}"
|
||
|
|
BorderBrush="{DynamicResource Item.SelectedActive.Border}"
|
||
|
|
BorderThickness="1"
|
||
|
|
SnapsToDevicePixels="True">
|
||
|
|
<controls:BiaClippingBorder.Effect>
|
||
|
|
<DropShadowEffect Color="Black" ShadowDepth="2.0" />
|
||
|
|
</controls:BiaClippingBorder.Effect>
|
||
|
|
|
||
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||
|
|
<ItemsPresenter />
|
||
|
|
</ScrollViewer>
|
||
|
|
</controls:BiaClippingBorder>
|
||
|
|
</Popup>
|
||
|
|
</Grid>
|
||
|
|
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="HasItems" Value="False">
|
||
|
|
<Setter TargetName="dropdown" Property="MinHeight" Value="100" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsGrouping" Value="True">
|
||
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter TargetName="toggleButton" Property="Background" Value="{DynamicResource BackgroundBrushKey}" />
|
||
|
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource ActiveBackgroundBrushKey}" />
|
||
|
|
<Setter TargetName="toggleButton" Property="BorderBrush" Value="{DynamicResource AccentBrushKey}" />
|
||
|
|
<Setter TargetName="toggleButton" Property="Foreground" Value="{DynamicResource AccentBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
|
||
|
|
<Setter TargetName="toggleButton" Property="Background" Value="{DynamicResource AccentBrushKey}" />
|
||
|
|
<Setter TargetName="toggleButton" Property="Foreground" Value="{DynamicResource AccentForegroundBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsEnabled" Value="False">
|
||
|
|
<Setter TargetName="border" Property="Background" Value="{DynamicResource InactiveBackgroundBrushKey}" />
|
||
|
|
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource InactiveBorderBrushKey}" />
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
|
|
</Style>
|
||
|
|
</ResourceDictionary>
|