feat: add avalonia menu style (step1).
This commit is contained in:
1 parent
aa4fa95ab1
commit
bb3c075398
11 files changed
+400
-11
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol">
|
||||
|
||||
<ControlTheme x:Key="ContextMenuBaseStyle"
|
||||
TargetType="ContextMenu">
|
||||
<Setter Property="hc:MenuAttach.ItemPadding"
|
||||
Value="{StaticResource DefaultControlPadding}" />
|
||||
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
|
||||
Value="-9" />
|
||||
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
|
||||
Value="10" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource RegionBrush}" />
|
||||
<Setter Property="hc:BorderElement.CornerRadius"
|
||||
Value="{StaticResource DefaultCornerRadius}" />
|
||||
<Setter Property="CornerRadius"
|
||||
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
|
||||
<Setter Property="Padding"
|
||||
Value="2,2,2,0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ContextMenu">
|
||||
<Border Effect="{StaticResource EffectShadow2}"
|
||||
Margin="8"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
MaxHeight="{TemplateBinding MaxHeight}"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource BorderBrush}">
|
||||
<ScrollViewer Theme="{StaticResource ScrollViewerUpDown}"
|
||||
Margin="{TemplateBinding Padding}">
|
||||
<ItemsPresenter Name="PART_ItemsPresenter"
|
||||
ItemsPanel="{TemplateBinding ItemsPanel}"
|
||||
KeyboardNavigation.TabNavigation="Continue" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="{x:Type ContextMenu}"
|
||||
BasedOn="{StaticResource ContextMenuBaseStyle}"
|
||||
TargetType="ContextMenu" />
|
||||
|
||||
<ControlTheme x:Key="ContextMenu.Small"
|
||||
BasedOn="{StaticResource ContextMenuBaseStyle}"
|
||||
TargetType="ContextMenu">
|
||||
<Setter Property="hc:MenuAttach.ItemPadding"
|
||||
Value="6,0" />
|
||||
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
|
||||
Value="-3" />
|
||||
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
|
||||
Value="6" />
|
||||
</ControlTheme>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user