|
| 1 | +<ResourceDictionary xmlns="https://github.com/avaloniaui" |
| 2 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | + xmlns:hc="https://handyorg.github.io/handycontrol" |
| 4 | + xmlns:sys="using:System"> |
| 5 | + |
| 6 | + <ControlTheme x:Key="MenuItemBaseStyle" |
| 7 | + TargetType="MenuItem"> |
| 8 | + <Setter Property="Padding" |
| 9 | + Value="{Binding Path=(hc:MenuAttach.ItemPadding),RelativeSource={RelativeSource AncestorType=MenuBase}}" /> |
| 10 | + <Setter Property="Background" |
| 11 | + Value="Transparent" /> |
| 12 | + <Setter Property="BorderThickness" |
| 13 | + Value="0" /> |
| 14 | + <Setter Property="Foreground" |
| 15 | + Value="{DynamicResource PrimaryTextBrush}" /> |
| 16 | + <Setter Property="Margin" |
| 17 | + Value="0,0,0,2" /> |
| 18 | + <Setter Property="CornerRadius" |
| 19 | + Value="{Binding $self.(hc:BorderElement.CornerRadius)}" /> |
| 20 | + <Setter Property="MinWidth" |
| 21 | + Value="240" /> |
| 22 | + <Setter Property="Template"> |
| 23 | + <ControlTemplate> |
| 24 | + <Border Name="root" |
| 25 | + Background="{TemplateBinding Background}" |
| 26 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 27 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 28 | + CornerRadius="{TemplateBinding CornerRadius}"> |
| 29 | + <Grid Margin="{TemplateBinding Padding}"> |
| 30 | + <Grid.ColumnDefinitions> |
| 31 | + <ColumnDefinition Width="26" /> |
| 32 | + <ColumnDefinition Width="*" /> |
| 33 | + <ColumnDefinition Width="30" /> |
| 34 | + <ColumnDefinition Width="Auto" |
| 35 | + SharedSizeGroup="MenuItemIGT" /> |
| 36 | + <ColumnDefinition Width="20" /> |
| 37 | + </Grid.ColumnDefinitions> |
| 38 | + <ContentControl Grid.Column="0" |
| 39 | + x:Name="PART_ToggleIconPresenter" |
| 40 | + IsVisible="False" |
| 41 | + Margin="3" |
| 42 | + Width="16" |
| 43 | + Height="16" /> |
| 44 | + <ContentControl Grid.Column="0" |
| 45 | + Name="PART_IconPresenter" |
| 46 | + Width="16" |
| 47 | + Height="16" |
| 48 | + Margin="3" |
| 49 | + HorizontalAlignment="Center" |
| 50 | + VerticalAlignment="Center" |
| 51 | + Content="{TemplateBinding Icon}" /> |
| 52 | + <ContentPresenter Name="PART_HeaderPresenter" |
| 53 | + Grid.Column="1" |
| 54 | + Margin="{TemplateBinding Padding}" |
| 55 | + VerticalAlignment="Center" |
| 56 | + Content="{TemplateBinding Header}" |
| 57 | + ContentTemplate="{TemplateBinding HeaderTemplate}"> |
| 58 | + <ContentPresenter.DataTemplates> |
| 59 | + <DataTemplate DataType="sys:String"> |
| 60 | + <AccessText Text="{Binding}" /> |
| 61 | + </DataTemplate> |
| 62 | + </ContentPresenter.DataTemplates> |
| 63 | + </ContentPresenter> |
| 64 | + <TextBlock x:Name="PART_InputGestureText" |
| 65 | + Grid.Column="3" |
| 66 | + VerticalAlignment="Center" |
| 67 | + Text="{TemplateBinding InputGesture, Converter={StaticResource PlatformKeyGestureConverter}}" /> |
| 68 | + <Path Name="rightArrow" |
| 69 | + Grid.Column="4" |
| 70 | + Margin="10,0,0,0" |
| 71 | + Width="10" |
| 72 | + Height="10" |
| 73 | + HorizontalAlignment="Left" |
| 74 | + VerticalAlignment="Center" |
| 75 | + Stretch="Uniform" |
| 76 | + Data="{StaticResource RightGeometry}" |
| 77 | + Fill="{TemplateBinding Foreground}" /> |
| 78 | + <Popup Grid.Column="1" |
| 79 | + Name="PART_Popup" |
| 80 | + IsLightDismissEnabled="False" |
| 81 | + IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}" |
| 82 | + Placement="RightEdgeAlignedTop"> |
| 83 | + <Border Background="{DynamicResource RegionBrush}" |
| 84 | + BorderBrush="{DynamicResource BorderBrush}" |
| 85 | + BorderThickness="1" |
| 86 | + CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"> |
| 87 | + <ScrollViewer Theme="{StaticResource ScrollViewerUpDown}" |
| 88 | + Margin="2,2,2,0"> |
| 89 | + <ItemsPresenter Name="PART_ItemsPresenter" |
| 90 | + Grid.IsSharedSizeScope="True" |
| 91 | + ItemsPanel="{TemplateBinding ItemsPanel}" /> |
| 92 | + </ScrollViewer> |
| 93 | + </Border> |
| 94 | + </Popup> |
| 95 | + </Grid> |
| 96 | + </Border> |
| 97 | + </ControlTemplate> |
| 98 | + </Setter> |
| 99 | + |
| 100 | + <Style Selector="^:selected /template/ Border#root"> |
| 101 | + <Setter Property="Background" |
| 102 | + Value="{DynamicResource SecondaryRegionBrush}" /> |
| 103 | + </Style> |
| 104 | + |
| 105 | + <Style Selector="^:empty /template/ Path#rightArrow"> |
| 106 | + <Setter Property="IsVisible" |
| 107 | + Value="False" /> |
| 108 | + </Style> |
| 109 | + </ControlTheme> |
| 110 | + |
| 111 | + <ControlTheme x:Key="MenuBaseStyle" |
| 112 | + TargetType="Menu"> |
| 113 | + <Setter Property="hc:MenuAttach.ItemPadding" |
| 114 | + Value="{StaticResource DefaultControlPadding}" /> |
| 115 | + <Setter Property="hc:MenuAttach.PopupVerticalOffset" |
| 116 | + Value="-9" /> |
| 117 | + <Setter Property="hc:MenuAttach.PopupHorizontalOffset" |
| 118 | + Value="10" /> |
| 119 | + <Setter Property="Background" |
| 120 | + Value="{DynamicResource RegionBrush}" /> |
| 121 | + <Setter Property="Foreground" |
| 122 | + Value="{DynamicResource PrimaryTextBrush}" /> |
| 123 | + <Setter Property="hc:BorderElement.CornerRadius" |
| 124 | + Value="{StaticResource DefaultCornerRadius}" /> |
| 125 | + <Setter Property="CornerRadius" |
| 126 | + Value="{Binding $self.(hc:BorderElement.CornerRadius)}" /> |
| 127 | + <Setter Property="Template"> |
| 128 | + <ControlTemplate> |
| 129 | + <Border Padding="{TemplateBinding Padding}" |
| 130 | + Background="{TemplateBinding Background}" |
| 131 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 132 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 133 | + CornerRadius="{TemplateBinding CornerRadius}"> |
| 134 | + <ItemsPresenter Name="PART_ItemsPresenter" |
| 135 | + ItemsPanel="{TemplateBinding ItemsPanel}" |
| 136 | + KeyboardNavigation.TabNavigation="Continue" /> |
| 137 | + </Border> |
| 138 | + </ControlTemplate> |
| 139 | + </Setter> |
| 140 | + </ControlTheme> |
| 141 | + |
| 142 | + <ControlTheme x:Key="{x:Type MenuItem}" |
| 143 | + BasedOn="{StaticResource MenuItemBaseStyle}" |
| 144 | + TargetType="MenuItem" /> |
| 145 | + |
| 146 | + <ControlTheme x:Key="{x:Type Menu}" |
| 147 | + BasedOn="{StaticResource MenuBaseStyle}" |
| 148 | + TargetType="Menu" /> |
| 149 | + |
| 150 | + <ControlTheme x:Key="Menu.Small" |
| 151 | + BasedOn="{StaticResource MenuBaseStyle}" |
| 152 | + TargetType="Menu"> |
| 153 | + <Setter Property="hc:MenuAttach.ItemPadding" |
| 154 | + Value="6,0" /> |
| 155 | + <Setter Property="hc:MenuAttach.PopupVerticalOffset" |
| 156 | + Value="-3" /> |
| 157 | + <Setter Property="hc:MenuAttach.PopupHorizontalOffset" |
| 158 | + Value="6" /> |
| 159 | + </ControlTheme> |
| 160 | + |
| 161 | +</ResourceDictionary> |
0 commit comments