172 lines
8.7 KiB
XML
172 lines
8.7 KiB
XML
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
|
xmlns:sys="using:System">
|
|
|
|
<ControlTheme x:Key="MenuItemBaseStyle"
|
|
TargetType="MenuItem">
|
|
<Setter Property="Padding"
|
|
Value="{Binding $self.(hc:MenuAttach.ItemPadding)}" />
|
|
<Setter Property="MinHeight"
|
|
Value="{Binding $self.(hc:MenuAttach.ItemMinHeight)}" />
|
|
<Setter Property="Background"
|
|
Value="Transparent" />
|
|
<Setter Property="BorderThickness"
|
|
Value="0" />
|
|
<Setter Property="Foreground"
|
|
Value="{DynamicResource PrimaryTextBrush}" />
|
|
<Setter Property="Margin"
|
|
Value="0,0,0,2" />
|
|
<Setter Property="CornerRadius"
|
|
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
|
|
<Setter Property="MinWidth"
|
|
Value="240" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Border Name="root"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
<Grid Margin="{TemplateBinding Padding}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="26" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="30" />
|
|
<ColumnDefinition Width="Auto"
|
|
SharedSizeGroup="MenuItemIGT" />
|
|
<ColumnDefinition Width="20" />
|
|
</Grid.ColumnDefinitions>
|
|
<ContentControl Grid.Column="0"
|
|
x:Name="PART_ToggleIconPresenter"
|
|
IsVisible="False"
|
|
Width="16"
|
|
Height="16"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Center" />
|
|
<ContentControl Grid.Column="0"
|
|
Name="PART_IconPresenter"
|
|
Width="16"
|
|
Height="16"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Center"
|
|
Content="{TemplateBinding Icon}" />
|
|
<ContentPresenter Name="PART_HeaderPresenter"
|
|
Grid.Column="1"
|
|
VerticalAlignment="Center"
|
|
Content="{TemplateBinding Header}"
|
|
ContentTemplate="{TemplateBinding HeaderTemplate}">
|
|
<ContentPresenter.DataTemplates>
|
|
<DataTemplate DataType="sys:String">
|
|
<AccessText Text="{Binding}" />
|
|
</DataTemplate>
|
|
</ContentPresenter.DataTemplates>
|
|
</ContentPresenter>
|
|
<TextBlock x:Name="PART_InputGestureText"
|
|
Grid.Column="3"
|
|
VerticalAlignment="Center"
|
|
HorizontalAlignment="Left"
|
|
Text="{TemplateBinding InputGesture, Converter={StaticResource PlatformKeyGestureConverter}}" />
|
|
<Path Name="rightArrow"
|
|
Grid.Column="4"
|
|
Margin="0,0,10,0"
|
|
Width="10"
|
|
Height="10"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Stretch="Uniform"
|
|
Data="{StaticResource RightGeometry}"
|
|
Fill="{TemplateBinding Foreground}" />
|
|
<Popup Grid.Column="1"
|
|
Name="PART_Popup"
|
|
IsLightDismissEnabled="False"
|
|
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"
|
|
Placement="RightEdgeAlignedTop"
|
|
VerticalOffset="{Binding $self.(hc:MenuAttach.PopupVerticalOffset)}"
|
|
HorizontalOffset="{Binding $self.(hc:MenuAttach.PopupHorizontalOffset)}">
|
|
<Border Background="{DynamicResource RegionBrush}"
|
|
BorderBrush="{DynamicResource BorderBrush}"
|
|
BorderThickness="1"
|
|
Margin="8"
|
|
Effect="{StaticResource EffectShadow2}"
|
|
CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
|
|
<ScrollViewer Theme="{StaticResource ScrollViewerUpDown}"
|
|
Margin="2,2,2,0">
|
|
<ItemsPresenter Name="PART_ItemsPresenter"
|
|
Grid.IsSharedSizeScope="True"
|
|
ItemsPanel="{TemplateBinding ItemsPanel}" />
|
|
</ScrollViewer>
|
|
</Border>
|
|
</Popup>
|
|
</Grid>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
|
|
<Style Selector="^:selected /template/ Border#root">
|
|
<Setter Property="Background"
|
|
Value="{DynamicResource SecondaryRegionBrush}" />
|
|
</Style>
|
|
|
|
<Style Selector="^:empty /template/ Path#rightArrow">
|
|
<Setter Property="IsVisible"
|
|
Value="False" />
|
|
</Style>
|
|
</ControlTheme>
|
|
|
|
<ControlTheme x:Key="MenuBaseStyle"
|
|
TargetType="Menu">
|
|
<Setter Property="hc:MenuAttach.ItemPadding"
|
|
Value="{StaticResource DefaultControlPadding}" />
|
|
<Setter Property="hc:MenuAttach.ItemMinHeight"
|
|
Value="{StaticResource DefaultControlHeight}" />
|
|
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
|
|
Value="-16" />
|
|
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
|
|
Value="1" />
|
|
<Setter Property="Background"
|
|
Value="{DynamicResource RegionBrush}" />
|
|
<Setter Property="Foreground"
|
|
Value="{DynamicResource PrimaryTextBrush}" />
|
|
<Setter Property="hc:BorderElement.CornerRadius"
|
|
Value="{StaticResource DefaultCornerRadius}" />
|
|
<Setter Property="CornerRadius"
|
|
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Border Padding="{TemplateBinding Padding}"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
<ItemsPresenter Name="PART_ItemsPresenter"
|
|
ItemsPanel="{TemplateBinding ItemsPanel}"
|
|
KeyboardNavigation.TabNavigation="Continue" />
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</ControlTheme>
|
|
|
|
<ControlTheme x:Key="{x:Type MenuItem}"
|
|
BasedOn="{StaticResource MenuItemBaseStyle}"
|
|
TargetType="MenuItem" />
|
|
|
|
<ControlTheme x:Key="{x:Type Menu}"
|
|
BasedOn="{StaticResource MenuBaseStyle}"
|
|
TargetType="Menu" />
|
|
|
|
<ControlTheme x:Key="Menu.Small"
|
|
BasedOn="{StaticResource MenuBaseStyle}"
|
|
TargetType="Menu">
|
|
<Setter Property="hc:MenuAttach.ItemPadding"
|
|
Value="6,0" />
|
|
<Setter Property="hc:MenuAttach.ItemMinHeight"
|
|
Value="20" />
|
|
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
|
|
Value="-11" />
|
|
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
|
|
Value="-2" />
|
|
</ControlTheme>
|
|
|
|
</ResourceDictionary>
|