优化菜单样式 #3132

1.优化菜单高度
2.优化菜单分隔符样式
3.去除菜单栏多余关闭按钮
4.主题按钮置右
This commit is contained in:
fonaix 2023-04-05 12:08:11 +08:00
parent 22475e459d
commit c18e729eaa
2 changed files with 269 additions and 310 deletions

View file

@ -16,6 +16,7 @@
SecondaryColor="Lime" /> SecondaryColor="Lime" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /> <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<system:Double x:Key="TopMenuItemHeight">32</system:Double>
<system:Double x:Key="MenuItemHeight">26</system:Double> <system:Double x:Key="MenuItemHeight">26</system:Double>
<system:Double x:Key="StdFontSize">12</system:Double> <system:Double x:Key="StdFontSize">12</system:Double>
<system:Double x:Key="StdFontSize1">13</system:Double> <system:Double x:Key="StdFontSize1">13</system:Double>
@ -141,7 +142,33 @@
TargetType="{x:Type ListBoxItem}"> TargetType="{x:Type ListBoxItem}">
<Setter Property="Margin" Value="-2,0" /> <Setter Property="Margin" Value="-2,0" />
</Style> </Style>
<Style x:Key="VerticalSeparatorStyle"
BasedOn="{StaticResource {x:Type Separator}}"
TargetType="{x:Type Separator}">
<Setter Property="Margin"
Value="2,2" />
<Setter Property="Background"
Value="LightGray" />
<Setter Property="LayoutTransform">
<Setter.Value>
<TransformGroup>
<TransformGroup.Children>
<TransformCollection>
<RotateTransform Angle="90" />
</TransformCollection>
</TransformGroup.Children>
</TransformGroup>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="HorizontalSeparatorStyle"
BasedOn="{StaticResource {x:Type Separator}}"
TargetType="{x:Type Separator}">
<Setter Property="Margin"
Value="2,2" />
<Setter Property="Background"
Value="LightGray" />
</Style>
</ResourceDictionary> </ResourceDictionary>

View file

@ -43,218 +43,177 @@
Style="{StaticResource MaterialDesignEmbeddedDialogHost}"> Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
<Grid> <Grid>
<DockPanel> <DockPanel>
<ToolBarTray DockPanel.Dock="Top"> <Grid DockPanel.Dock="Top">
<ToolBar <Menu Margin="0,1"
HorizontalAlignment="Center" Style="{StaticResource ToolbarMenu}">
VerticalAlignment="Center" <MenuItem Padding="8,0"
ClipToBounds="True" Height="{StaticResource TopMenuItemHeight}">
Style="{StaticResource MaterialDesignToolBar}">
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}">
<MenuItem Padding="8,0">
<MenuItem.Header> <MenuItem.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon Margin="0,0,8,0"
Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Kind="Server" /> Kind="Server" />
<TextBlock Text="{x:Static resx:ResUI.menuServers}" /> <TextBlock Text="{x:Static resx:ResUI.menuServers}" />
</StackPanel> </StackPanel>
</MenuItem.Header> </MenuItem.Header>
<MenuItem <MenuItem x:Name="menuAddCustomServer"
x:Name="menuAddCustomServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddCustomServer}" /> Header="{x:Static resx:ResUI.menuAddCustomServer}" />
<Separator Margin="-40,5" /> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuAddVmessServer"
x:Name="menuAddVmessServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddVmessServer}" /> Header="{x:Static resx:ResUI.menuAddVmessServer}" />
<MenuItem <MenuItem x:Name="menuAddVlessServer"
x:Name="menuAddVlessServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddVlessServer}" /> Header="{x:Static resx:ResUI.menuAddVlessServer}" />
<MenuItem <MenuItem x:Name="menuAddShadowsocksServer"
x:Name="menuAddShadowsocksServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddShadowsocksServer}" /> Header="{x:Static resx:ResUI.menuAddShadowsocksServer}" />
<MenuItem <MenuItem x:Name="menuAddSocksServer"
x:Name="menuAddSocksServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddSocksServer}" /> Header="{x:Static resx:ResUI.menuAddSocksServer}" />
<MenuItem <MenuItem x:Name="menuAddTrojanServer"
x:Name="menuAddTrojanServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddTrojanServer}" /> Header="{x:Static resx:ResUI.menuAddTrojanServer}" />
<Separator Margin="-40,5" /> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuAddServerViaClipboard"
x:Name="menuAddServerViaClipboard"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" /> Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" />
<MenuItem <MenuItem x:Name="menuAddServerViaScan"
x:Name="menuAddServerViaScan"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddServerViaScan}" /> Header="{x:Static resx:ResUI.menuAddServerViaScan}" />
</MenuItem> </MenuItem>
</Menu> <Separator Style="{StaticResource VerticalSeparatorStyle}" />
<Separator /> <MenuItem Padding="8,0"
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> Height="{StaticResource TopMenuItemHeight}">
<MenuItem Padding="8,0">
<MenuItem.Header> <MenuItem.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon Margin="0,0,8,0"
Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Kind="BookClockOutline" /> Kind="BookClockOutline" />
<TextBlock Text="{x:Static resx:ResUI.menuSubscription}" /> <TextBlock Text="{x:Static resx:ResUI.menuSubscription}" />
</StackPanel> </StackPanel>
</MenuItem.Header> </MenuItem.Header>
<MenuItem <MenuItem x:Name="menuSubSetting"
x:Name="menuSubSetting"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSubSetting}" /> Header="{x:Static resx:ResUI.menuSubSetting}" />
<Separator Margin="-40,5" /> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuSubUpdate"
x:Name="menuSubUpdate"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSubUpdate}" /> Header="{x:Static resx:ResUI.menuSubUpdate}" />
<MenuItem <MenuItem x:Name="menuSubUpdateViaProxy"
x:Name="menuSubUpdateViaProxy"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" /> Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" />
<MenuItem <MenuItem x:Name="menuSubGroupUpdate"
x:Name="menuSubGroupUpdate"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSubGroupUpdate}" /> Header="{x:Static resx:ResUI.menuSubGroupUpdate}" />
<MenuItem <MenuItem x:Name="menuSubGroupUpdateViaProxy"
x:Name="menuSubGroupUpdateViaProxy"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuSubGroupUpdateViaProxy}" /> Header="{x:Static resx:ResUI.menuSubGroupUpdateViaProxy}" />
</MenuItem> </MenuItem>
</Menu> <Separator Style="{StaticResource VerticalSeparatorStyle}" />
<Separator /> <MenuItem Padding="8,0"
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> Height="{StaticResource TopMenuItemHeight}">
<MenuItem Padding="8,0">
<MenuItem.Header> <MenuItem.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon Margin="0,0,8,0"
Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Kind="SettingsOutline" /> Kind="SettingsOutline" />
<TextBlock Text="{x:Static resx:ResUI.menuSetting}" /> <TextBlock Text="{x:Static resx:ResUI.menuSetting}" />
</StackPanel> </StackPanel>
</MenuItem.Header> </MenuItem.Header>
<MenuItem <MenuItem x:Name="menuOptionSetting"
x:Name="menuOptionSetting"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuOptionSetting}" /> Header="{x:Static resx:ResUI.menuOptionSetting}" />
<MenuItem <MenuItem x:Name="menuRoutingSetting"
x:Name="menuRoutingSetting"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuRoutingSetting}" /> Header="{x:Static resx:ResUI.menuRoutingSetting}" />
<MenuItem <MenuItem x:Name="menuGlobalHotkeySetting"
x:Name="menuGlobalHotkeySetting"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" /> Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" />
<Separator Margin="-40,5" /> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuSettingsSetUWP"
x:Name="menuSettingsSetUWP"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Click="menuSettingsSetUWP_Click" Click="menuSettingsSetUWP_Click"
Header="{x:Static resx:ResUI.TbSettingsSetUWP}" /> Header="{x:Static resx:ResUI.TbSettingsSetUWP}" />
<MenuItem <MenuItem x:Name="menuClearServerStatistics"
x:Name="menuClearServerStatistics"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuClearServerStatistics}" /> Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
<Separator Margin="-40,5" /> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuImportOldGuiConfig"
x:Name="menuImportOldGuiConfig"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" /> Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" />
</MenuItem> </MenuItem>
</Menu> <Separator Style="{StaticResource VerticalSeparatorStyle}" />
<Separator /> <MenuItem x:Name="menuReload"
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> Height="{StaticResource TopMenuItemHeight}"
<MenuItem x:Name="menuReload" Padding="8,0"> Padding="8,0">
<MenuItem.Header> <MenuItem.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon Margin="0,0,8,0"
Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Kind="Reload" /> Kind="Reload" />
<TextBlock Text="{x:Static resx:ResUI.menuReload}" /> <TextBlock Text="{x:Static resx:ResUI.menuReload}" />
</StackPanel> </StackPanel>
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
</Menu> <Separator Style="{StaticResource VerticalSeparatorStyle}" />
<Separator /> <MenuItem Padding="8,0"
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> Height="{StaticResource TopMenuItemHeight}">
<MenuItem Padding="8,0">
<MenuItem.Header> <MenuItem.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon Margin="0,0,8,0"
Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Kind="Update" /> Kind="Update" />
<TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" /> <TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" />
</StackPanel> </StackPanel>
</MenuItem.Header> </MenuItem.Header>
<MenuItem <MenuItem x:Name="menuCheckUpdateN"
x:Name="menuCheckUpdateN"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="v2rayN" /> Header="v2rayN" />
<MenuItem <MenuItem x:Name="menuCheckUpdateV2flyCore"
x:Name="menuCheckUpdateV2flyCore"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="V2fly v5 Core" /> Header="V2fly v5 Core" />
<MenuItem <MenuItem x:Name="menuCheckUpdateSagerNetCore"
x:Name="menuCheckUpdateSagerNetCore"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="SagerNet Core" /> Header="SagerNet Core" />
<MenuItem <MenuItem x:Name="menuCheckUpdateXrayCore"
x:Name="menuCheckUpdateXrayCore"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="Xray Core" /> Header="Xray Core" />
<Separator Margin="-40,5" /> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuCheckUpdateClashCore"
x:Name="menuCheckUpdateClashCore"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="Clash Core" /> Header="Clash Core" />
<MenuItem <MenuItem x:Name="menuCheckUpdateClashMetaCore"
x:Name="menuCheckUpdateClashMetaCore"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="Clash.Meta Core" /> Header="Clash.Meta Core" />
<Separator Margin="-40,5" /> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuCheckUpdateGeo"
x:Name="menuCheckUpdateGeo"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="Geo files" /> Header="Geo files" />
</MenuItem> </MenuItem>
</Menu> <Separator Style="{StaticResource VerticalSeparatorStyle}" />
<Separator /> <MenuItem x:Name="menuHelp"
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> Height="{StaticResource TopMenuItemHeight}"
<MenuItem x:Name="menuHelp" Padding="8,0"> Padding="8,0">
<MenuItem.Header> <MenuItem.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon Margin="0,0,8,0"
Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Kind="HelpCircleOutline" /> Kind="HelpCircleOutline" />
<TextBlock Text="{x:Static resx:ResUI.menuHelp}" /> <TextBlock Text="{x:Static resx:ResUI.menuHelp}" />
</StackPanel> </StackPanel>
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
</Menu> <Separator Style="{StaticResource VerticalSeparatorStyle}" />
<Separator /> <MenuItem x:Name="menuPromotion"
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}">
<MenuItem
x:Name="menuPromotion"
Padding="8,0" Padding="8,0"
Height="{StaticResource TopMenuItemHeight}"
Click="menuPromotion_Click"> Click="menuPromotion_Click">
<MenuItem.Header> <MenuItem.Header>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon <materialDesign:PackIcon Margin="0,0,8,0"
Margin="0,0,8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
Kind="VolumeHigh" /> Kind="VolumeHigh" />
<TextBlock Text="{x:Static resx:ResUI.menuPromotion}" /> <TextBlock Text="{x:Static resx:ResUI.menuPromotion}" />
@ -262,26 +221,8 @@
</MenuItem.Header> </MenuItem.Header>
</MenuItem> </MenuItem>
</Menu> </Menu>
<Separator />
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}">
<MenuItem
x:Name="menuClose"
Padding="8,0"
Click="menuClose_Click">
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="Minimize" />
<TextBlock Text="{x:Static resx:ResUI.menuClose}" />
</StackPanel>
</MenuItem.Header>
</MenuItem>
</Menu>
<materialDesign:PopupBox <materialDesign:PopupBox Padding="8,0"
Padding="8,0"
HorizontalAlignment="Right" HorizontalAlignment="Right"
StaysOpen="True" StaysOpen="True"
Style="{StaticResource MaterialDesignToolForegroundPopupBox}"> Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
@ -297,26 +238,22 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock <TextBlock Grid.Row="0"
Grid.Row="0"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsColorMode}" /> Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
<ToggleButton <ToggleButton x:Name="togDarkMode"
x:Name="togDarkMode"
Grid.Row="0" Grid.Row="0"
Grid.Column="1" Grid.Column="1"
Margin="8" /> Margin="8" />
<TextBlock <TextBlock Grid.Row="1"
Grid.Row="1"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsColor}" /> Text="{x:Static resx:ResUI.TbSettingsColor}" />
<ComboBox <ComboBox x:Name="cmbSwatches"
x:Name="cmbSwatches"
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
Width="100" Width="100"
@ -324,28 +261,24 @@
DisplayMemberPath="Name" DisplayMemberPath="Name"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock Grid.Row="2"
Grid.Row="2"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsFontSize}" /> Text="{x:Static resx:ResUI.TbSettingsFontSize}" />
<ComboBox <ComboBox x:Name="cmbCurrentFontSize"
x:Name="cmbCurrentFontSize"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Width="100" Width="100"
Margin="8" Margin="8"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock Grid.Row="3"
Grid.Row="3"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsLanguage}" /> Text="{x:Static resx:ResUI.TbSettingsLanguage}" />
<ComboBox <ComboBox x:Name="cmbCurrentLanguage"
x:Name="cmbCurrentLanguage"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Width="100" Width="100"
@ -356,8 +289,7 @@
</Grid> </Grid>
</StackPanel> </StackPanel>
</materialDesign:PopupBox> </materialDesign:PopupBox>
</ToolBar> </Grid>
</ToolBarTray>
<WrapPanel Margin="2" DockPanel.Dock="Top"> <WrapPanel Margin="2" DockPanel.Dock="Top">
<ListBox <ListBox
x:Name="lstGroup" x:Name="lstGroup"