优化菜单样式 #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,321 +43,253 @@
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}"> <MenuItem.Header>
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> <StackPanel Orientation="Horizontal">
<MenuItem Padding="8,0"> <materialDesign:PackIcon Margin="0,0,8,0"
<MenuItem.Header> VerticalAlignment="Center"
<StackPanel Orientation="Horizontal"> Kind="Server" />
<materialDesign:PackIcon <TextBlock Text="{x:Static resx:ResUI.menuServers}" />
Margin="0,0,8,0" </StackPanel>
VerticalAlignment="Center" </MenuItem.Header>
Kind="Server" /> <MenuItem x:Name="menuAddCustomServer"
<TextBlock Text="{x:Static resx:ResUI.menuServers}" /> Height="{StaticResource MenuItemHeight}"
</StackPanel> Header="{x:Static resx:ResUI.menuAddCustomServer}" />
</MenuItem.Header> <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
<MenuItem <MenuItem x:Name="menuAddVmessServer"
x:Name="menuAddCustomServer" Height="{StaticResource MenuItemHeight}"
Height="{StaticResource MenuItemHeight}" Header="{x:Static resx:ResUI.menuAddVmessServer}" />
Header="{x:Static resx:ResUI.menuAddCustomServer}" /> <MenuItem x:Name="menuAddVlessServer"
<Separator Margin="-40,5" /> Height="{StaticResource MenuItemHeight}"
<MenuItem Header="{x:Static resx:ResUI.menuAddVlessServer}" />
x:Name="menuAddVmessServer" <MenuItem x:Name="menuAddShadowsocksServer"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddVmessServer}" /> Header="{x:Static resx:ResUI.menuAddShadowsocksServer}" />
<MenuItem <MenuItem x:Name="menuAddSocksServer"
x:Name="menuAddVlessServer" Height="{StaticResource MenuItemHeight}"
Height="{StaticResource MenuItemHeight}" Header="{x:Static resx:ResUI.menuAddSocksServer}" />
Header="{x:Static resx:ResUI.menuAddVlessServer}" /> <MenuItem x:Name="menuAddTrojanServer"
<MenuItem Height="{StaticResource MenuItemHeight}"
x:Name="menuAddShadowsocksServer" Header="{x:Static resx:ResUI.menuAddTrojanServer}" />
Height="{StaticResource MenuItemHeight}" <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
Header="{x:Static resx:ResUI.menuAddShadowsocksServer}" /> <MenuItem x:Name="menuAddServerViaClipboard"
<MenuItem Height="{StaticResource MenuItemHeight}"
x:Name="menuAddSocksServer" Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" />
Height="{StaticResource MenuItemHeight}" <MenuItem x:Name="menuAddServerViaScan"
Header="{x:Static resx:ResUI.menuAddSocksServer}" /> Height="{StaticResource MenuItemHeight}"
<MenuItem Header="{x:Static resx:ResUI.menuAddServerViaScan}" />
x:Name="menuAddTrojanServer"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddTrojanServer}" />
<Separator Margin="-40,5" />
<MenuItem
x:Name="menuAddServerViaClipboard"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" />
<MenuItem
x:Name="menuAddServerViaScan"
Height="{StaticResource MenuItemHeight}"
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 Margin="0,0,8,0"
<materialDesign:PackIcon VerticalAlignment="Center"
Margin="0,0,8,0" Kind="BookClockOutline" />
VerticalAlignment="Center" <TextBlock Text="{x:Static resx:ResUI.menuSubscription}" />
Kind="BookClockOutline" /> </StackPanel>
<TextBlock Text="{x:Static resx:ResUI.menuSubscription}" /> </MenuItem.Header>
</StackPanel> <MenuItem x:Name="menuSubSetting"
</MenuItem.Header> Height="{StaticResource MenuItemHeight}"
<MenuItem Header="{x:Static resx:ResUI.menuSubSetting}" />
x:Name="menuSubSetting" <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
Height="{StaticResource MenuItemHeight}" <MenuItem x:Name="menuSubUpdate"
Header="{x:Static resx:ResUI.menuSubSetting}" /> Height="{StaticResource MenuItemHeight}"
<Separator Margin="-40,5" /> Header="{x:Static resx:ResUI.menuSubUpdate}" />
<MenuItem <MenuItem x:Name="menuSubUpdateViaProxy"
x:Name="menuSubUpdate" Height="{StaticResource MenuItemHeight}"
Height="{StaticResource MenuItemHeight}" Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" />
Header="{x:Static resx:ResUI.menuSubUpdate}" /> <MenuItem x:Name="menuSubGroupUpdate"
<MenuItem Height="{StaticResource MenuItemHeight}"
x:Name="menuSubUpdateViaProxy" Header="{x:Static resx:ResUI.menuSubGroupUpdate}" />
Height="{StaticResource MenuItemHeight}" <MenuItem x:Name="menuSubGroupUpdateViaProxy"
Header="{x:Static resx:ResUI.menuSubUpdateViaProxy}" /> Height="{StaticResource MenuItemHeight}"
<MenuItem Header="{x:Static resx:ResUI.menuSubGroupUpdateViaProxy}" />
x:Name="menuSubGroupUpdate" </MenuItem>
Height="{StaticResource MenuItemHeight}" <Separator Style="{StaticResource VerticalSeparatorStyle}" />
Header="{x:Static resx:ResUI.menuSubGroupUpdate}" /> <MenuItem Padding="8,0"
<MenuItem Height="{StaticResource TopMenuItemHeight}">
x:Name="menuSubGroupUpdateViaProxy" <MenuItem.Header>
Height="{StaticResource MenuItemHeight}" <StackPanel Orientation="Horizontal">
Header="{x:Static resx:ResUI.menuSubGroupUpdateViaProxy}" /> <materialDesign:PackIcon Margin="0,0,8,0"
</MenuItem> VerticalAlignment="Center"
</Menu> Kind="SettingsOutline" />
<Separator /> <TextBlock Text="{x:Static resx:ResUI.menuSetting}" />
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> </StackPanel>
<MenuItem Padding="8,0"> </MenuItem.Header>
<MenuItem.Header> <MenuItem x:Name="menuOptionSetting"
<StackPanel Orientation="Horizontal"> Height="{StaticResource MenuItemHeight}"
<materialDesign:PackIcon Header="{x:Static resx:ResUI.menuOptionSetting}" />
Margin="0,0,8,0" <MenuItem x:Name="menuRoutingSetting"
VerticalAlignment="Center" Height="{StaticResource MenuItemHeight}"
Kind="SettingsOutline" /> Header="{x:Static resx:ResUI.menuRoutingSetting}" />
<TextBlock Text="{x:Static resx:ResUI.menuSetting}" /> <MenuItem x:Name="menuGlobalHotkeySetting"
</StackPanel> Height="{StaticResource MenuItemHeight}"
</MenuItem.Header> Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" />
<MenuItem <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
x:Name="menuOptionSetting" <MenuItem x:Name="menuSettingsSetUWP"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuOptionSetting}" /> Click="menuSettingsSetUWP_Click"
<MenuItem Header="{x:Static resx:ResUI.TbSettingsSetUWP}" />
x:Name="menuRoutingSetting" <MenuItem x:Name="menuClearServerStatistics"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuRoutingSetting}" /> Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
<MenuItem <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
x:Name="menuGlobalHotkeySetting" <MenuItem x:Name="menuImportOldGuiConfig"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" /> Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" />
<Separator Margin="-40,5" /> </MenuItem>
<MenuItem <Separator Style="{StaticResource VerticalSeparatorStyle}" />
x:Name="menuSettingsSetUWP" <MenuItem x:Name="menuReload"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource TopMenuItemHeight}"
Click="menuSettingsSetUWP_Click" Padding="8,0">
Header="{x:Static resx:ResUI.TbSettingsSetUWP}" /> <MenuItem.Header>
<MenuItem <StackPanel Orientation="Horizontal">
x:Name="menuClearServerStatistics" <materialDesign:PackIcon Margin="0,0,8,0"
Height="{StaticResource MenuItemHeight}" VerticalAlignment="Center"
Header="{x:Static resx:ResUI.menuClearServerStatistics}" /> Kind="Reload" />
<Separator Margin="-40,5" /> <TextBlock Text="{x:Static resx:ResUI.menuReload}" />
<MenuItem </StackPanel>
x:Name="menuImportOldGuiConfig" </MenuItem.Header>
Height="{StaticResource MenuItemHeight}" </MenuItem>
Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" /> <Separator Style="{StaticResource VerticalSeparatorStyle}" />
</MenuItem> <MenuItem Padding="8,0"
</Menu> Height="{StaticResource TopMenuItemHeight}">
<Separator /> <MenuItem.Header>
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> <StackPanel Orientation="Horizontal">
<MenuItem x:Name="menuReload" Padding="8,0"> <materialDesign:PackIcon Margin="0,0,8,0"
<MenuItem.Header> VerticalAlignment="Center"
<StackPanel Orientation="Horizontal"> Kind="Update" />
<materialDesign:PackIcon <TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" />
Margin="0,0,8,0" </StackPanel>
VerticalAlignment="Center" </MenuItem.Header>
Kind="Reload" /> <MenuItem x:Name="menuCheckUpdateN"
<TextBlock Text="{x:Static resx:ResUI.menuReload}" /> Height="{StaticResource MenuItemHeight}"
</StackPanel> Header="v2rayN" />
</MenuItem.Header> <MenuItem x:Name="menuCheckUpdateV2flyCore"
</MenuItem> Height="{StaticResource MenuItemHeight}"
</Menu> Header="V2fly v5 Core" />
<Separator /> <MenuItem x:Name="menuCheckUpdateSagerNetCore"
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> Height="{StaticResource MenuItemHeight}"
<MenuItem Padding="8,0"> Header="SagerNet Core" />
<MenuItem.Header> <MenuItem x:Name="menuCheckUpdateXrayCore"
<StackPanel Orientation="Horizontal"> Height="{StaticResource MenuItemHeight}"
<materialDesign:PackIcon Header="Xray Core" />
Margin="0,0,8,0" <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
VerticalAlignment="Center" <MenuItem x:Name="menuCheckUpdateClashCore"
Kind="Update" /> Height="{StaticResource MenuItemHeight}"
<TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" /> Header="Clash Core" />
</StackPanel> <MenuItem x:Name="menuCheckUpdateClashMetaCore"
</MenuItem.Header> Height="{StaticResource MenuItemHeight}"
<MenuItem Header="Clash.Meta Core" />
x:Name="menuCheckUpdateN" <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
Height="{StaticResource MenuItemHeight}" <MenuItem x:Name="menuCheckUpdateGeo"
Header="v2rayN" /> Height="{StaticResource MenuItemHeight}"
<MenuItem Header="Geo files" />
x:Name="menuCheckUpdateV2flyCore" </MenuItem>
Height="{StaticResource MenuItemHeight}" <Separator Style="{StaticResource VerticalSeparatorStyle}" />
Header="V2fly v5 Core" /> <MenuItem x:Name="menuHelp"
<MenuItem Height="{StaticResource TopMenuItemHeight}"
x:Name="menuCheckUpdateSagerNetCore" Padding="8,0">
Height="{StaticResource MenuItemHeight}" <MenuItem.Header>
Header="SagerNet Core" /> <StackPanel Orientation="Horizontal">
<MenuItem <materialDesign:PackIcon Margin="0,0,8,0"
x:Name="menuCheckUpdateXrayCore" VerticalAlignment="Center"
Height="{StaticResource MenuItemHeight}" Kind="HelpCircleOutline" />
Header="Xray Core" /> <TextBlock Text="{x:Static resx:ResUI.menuHelp}" />
<Separator Margin="-40,5" /> </StackPanel>
<MenuItem </MenuItem.Header>
x:Name="menuCheckUpdateClashCore" </MenuItem>
Height="{StaticResource MenuItemHeight}" <Separator Style="{StaticResource VerticalSeparatorStyle}" />
Header="Clash Core" /> <MenuItem x:Name="menuPromotion"
<MenuItem Padding="8,0"
x:Name="menuCheckUpdateClashMetaCore" Height="{StaticResource TopMenuItemHeight}"
Height="{StaticResource MenuItemHeight}" Click="menuPromotion_Click">
Header="Clash.Meta Core" /> <MenuItem.Header>
<Separator Margin="-40,5" /> <StackPanel Orientation="Horizontal">
<MenuItem <materialDesign:PackIcon Margin="0,0,8,0"
x:Name="menuCheckUpdateGeo" VerticalAlignment="Center"
Height="{StaticResource MenuItemHeight}" Kind="VolumeHigh" />
Header="Geo files" /> <TextBlock Text="{x:Static resx:ResUI.menuPromotion}" />
</MenuItem> </StackPanel>
</Menu> </MenuItem.Header>
<Separator /> </MenuItem>
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}"> </Menu>
<MenuItem x:Name="menuHelp" Padding="8,0">
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="HelpCircleOutline" />
<TextBlock Text="{x:Static resx:ResUI.menuHelp}" />
</StackPanel>
</MenuItem.Header>
</MenuItem>
</Menu>
<Separator />
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}">
<MenuItem
x:Name="menuPromotion"
Padding="8,0"
Click="menuPromotion_Click">
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="VolumeHigh" />
<TextBlock Text="{x:Static resx:ResUI.menuPromotion}" />
</StackPanel>
</MenuItem.Header>
</MenuItem>
</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}"> <StackPanel Margin="8">
<StackPanel Margin="8"> <Grid>
<Grid> <Grid.RowDefinitions>
<Grid.RowDefinitions> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> </Grid.RowDefinitions>
</Grid.RowDefinitions> <Grid.ColumnDefinitions>
<Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions>
</Grid.ColumnDefinitions> <TextBlock Grid.Row="0"
<TextBlock Grid.Column="0"
Grid.Row="0" VerticalAlignment="Center"
Grid.Column="0" Style="{StaticResource ToolbarTextBlock}"
VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
Style="{StaticResource ToolbarTextBlock}" <ToggleButton x:Name="togDarkMode"
Text="{x:Static resx:ResUI.TbSettingsColorMode}" /> Grid.Row="0"
<ToggleButton Grid.Column="1"
x:Name="togDarkMode" Margin="8" />
Grid.Row="0"
Grid.Column="1"
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 x:Name="cmbSwatches"
<ComboBox Grid.Row="1"
x:Name="cmbSwatches" Grid.Column="1"
Grid.Row="1" Width="100"
Grid.Column="1" Margin="8"
Width="100" DisplayMemberPath="Name"
Margin="8" Style="{StaticResource DefComboBox}" />
DisplayMemberPath="Name"
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 x:Name="cmbCurrentFontSize"
<ComboBox Grid.Row="2"
x:Name="cmbCurrentFontSize" Grid.Column="1"
Grid.Row="2" Width="100"
Grid.Column="1" Margin="8"
Width="100" Style="{StaticResource DefComboBox}" />
Margin="8"
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 x:Name="cmbCurrentLanguage"
<ComboBox Grid.Row="3"
x:Name="cmbCurrentLanguage" Grid.Column="1"
Grid.Row="3" Width="100"
Grid.Column="1" Margin="8"
Width="100" materialDesign:HintAssist.Hint="Language"
Margin="8" Style="{StaticResource DefComboBox}" />
materialDesign:HintAssist.Hint="Language"
Style="{StaticResource DefComboBox}" />
</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"