Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update menu style #439

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/Semi.Avalonia/Controls/Menu.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@
</ControlTheme>

<ControlTheme x:Key="{x:Type Separator}" TargetType="Separator">
<Setter Property="Separator.Background" Value="{DynamicResource MenuItemSeparatorBackground}" />
<Setter Property="Separator.Focusable" Value="False" />
<Setter Property="Separator.Height" Value="{DynamicResource MenuItemSeparatorHeight}" />
<Setter Property="Separator.HorizontalAlignment" Value="Stretch" />
<Setter Property="Separator.Margin" Value="{DynamicResource MenuItemSeparatorMargin}" />
<Setter Property="Separator.Template">
<Setter Property="Background" Value="{DynamicResource MenuItemSeparatorBackground}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Height" Value="{DynamicResource MenuItemSeparatorHeight}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Margin" Value="{DynamicResource MenuItemSeparatorMargin}" />
<Setter Property="Template">
<ControlTemplate TargetType="Separator">
<Border
Height="{TemplateBinding Height}"
Expand All @@ -115,7 +115,8 @@
<ControlTheme x:Key="{x:Type MenuItem}" TargetType="MenuItem">
<Setter Property="Background" Value="{DynamicResource MenuItemBackground}" />
<Setter Property="Foreground" Value="{DynamicResource MenuItemForeground}" />
<Setter Property="MenuItem.Cursor" Value="Hand" />
<Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}" />
<Setter Property="Cursor" Value="Hand" />
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
<Setter Property="Template">
Expand Down Expand Up @@ -293,7 +294,8 @@
<ControlTheme x:Key="TopLevelMenuItem" TargetType="MenuItem">
<Setter Property="Background" Value="{DynamicResource MenuItemBackground}" />
<Setter Property="Foreground" Value="{DynamicResource MenuItemForeground}" />
<Setter Property="MenuItem.Cursor" Value="Hand" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}"/>
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
<Setter Property="Template">
Expand Down Expand Up @@ -369,8 +371,8 @@
</ControlTheme>

<ControlTheme x:Key="{x:Type Menu}" TargetType="Menu">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Menu.ItemContainerTheme" Value="{StaticResource TopLevelMenuItem}" />
<Setter Property="Background" Value="{DynamicResource MenuBackground}" />
<Setter Property="ItemContainerTheme" Value="{StaticResource TopLevelMenuItem}" />
<Setter Property="Template">
<ControlTemplate TargetType="Menu">
<Border
Expand Down
3 changes: 2 additions & 1 deletion src/Semi.Avalonia/Themes/Dark/Menu.axaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="MenuFlyoutScrollViewerIconForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="MenuBackground" Color="Transparent"/>

<!-- MenuFlyout -->
<SolidColorBrush x:Key="MenuFlyoutBackground" Color="#43444A" />
<SolidColorBrush x:Key="MenuFlyoutBorderBrush" Opacity="0.08" Color="White" />
<BoxShadows x:Key="MenuFlyoutBorderBoxShadow">0 0 8 0 #1AFFFFFF</BoxShadows>

<!-- MenuItem -->
<SolidColorBrush x:Key="MenuItemBackground" Color="#43444A" />
<SolidColorBrush x:Key="MenuItemBackground" Color="Transparent" />
<SolidColorBrush x:Key="MenuItemForeground" Color="#F9F9F9" />

<SolidColorBrush x:Key="MenuItemSeparatorBackground" Opacity="0.08" Color="White" />
Expand Down
3 changes: 2 additions & 1 deletion src/Semi.Avalonia/Themes/Light/Menu.axaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="MenuFlyoutScrollViewerIconForeground" Opacity="0.62" Color="#1C1F23" />
<SolidColorBrush x:Key="MenuBackground" Color="Transparent"/>

<!-- MenuFlyout -->
<SolidColorBrush x:Key="MenuFlyoutBackground" Color="White" />
<SolidColorBrush x:Key="MenuFlyoutBorderBrush" Opacity="0.08" Color="#1C1F23" />
<BoxShadows x:Key="MenuFlyoutBorderBoxShadow">0 0 8 0 #1A000000</BoxShadows>

<!-- MenuItem -->
<SolidColorBrush x:Key="MenuItemBackground" Color="White" />
<SolidColorBrush x:Key="MenuItemBackground" Color="Transparent" />
<SolidColorBrush x:Key="MenuItemForeground" Color="#1C1F23" />

<SolidColorBrush x:Key="MenuItemSeparatorBackground" Opacity="0.08" Color="#1C1F23" />
Expand Down
2 changes: 2 additions & 0 deletions src/Semi.Avalonia/Themes/Shared/Menu.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

<!-- MenuItem -->
<Thickness x:Key="MenuItemPadding">16 8</Thickness>

<CornerRadius x:Key="MenuItemCornerRadius">3</CornerRadius>

<x:Double x:Key="MenuItemSeparatorHeight">1</x:Double>
<Thickness x:Key="MenuItemSeparatorMargin">2</Thickness>
Expand Down