85 lines
6.7 KiB
XML
85 lines
6.7 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:HandyControl.Controls">
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="MenuBaseStyle.xaml"/>
|
|
<ResourceDictionary Source="../ToggleButton.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<Style x:Key="SplitButtonBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="controls:SplitButton">
|
|
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
|
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
|
<Setter Property="controls:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="controls:SplitButton">
|
|
<controls:SimplePanel x:Name="templateRoot">
|
|
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
|
|
<Path x:Name="PathMain" Width="{TemplateBinding controls:IconElement.Width}" Height="{TemplateBinding controls:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}"/>
|
|
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
|
</StackPanel>
|
|
<ToggleButton x:Name="PART_Arrow" Foreground="{TemplateBinding Foreground}" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Width="22" Height="Auto" Padding="0,10,8,10" HorizontalContentAlignment="Left" Grid.Column="1" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" controls:IconElement.Geometry="{StaticResource DownGeometry}"/>
|
|
</Grid>
|
|
</Border>
|
|
<Popup AllowsTransparency="true" StaysOpen="False" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="Fade" Placement="Bottom">
|
|
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Background="{DynamicResource RegionBrush}">
|
|
<ScrollViewer Margin="0,4" x:Name="DropDownScrollViewer">
|
|
<controls:SimplePanel RenderOptions.ClearTypeHint="Enabled">
|
|
<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
|
|
<Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
|
|
</Canvas>
|
|
<ContentPresenter ContentSource="DropDownContent"/>
|
|
</controls:SimplePanel>
|
|
</ScrollViewer>
|
|
</Border>
|
|
</Popup>
|
|
</controls:SimplePanel>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="Content" Value="{x:Null}">
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain"/>
|
|
</Trigger>
|
|
<Trigger Property="controls:IconElement.Geometry" Value="{x:Null}">
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/>
|
|
<Setter Property="Margin" Value="0" TargetName="ContentPresenterMain"/>
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="HitMode" Value="Click"/>
|
|
<Condition Property="IsChecked" Value="True" SourceName="PART_Arrow"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="IsDropDownOpen" Value="True"/>
|
|
</MultiTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Opacity" Value=".9"/>
|
|
</Trigger>
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter Property="Opacity" Value=".6"/>
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Opacity" Value="0.4"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
</ResourceDictionary> |