优化修改菜单名样式
This commit is contained in:
@@ -44,39 +44,38 @@
|
|||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</MultiTrigger.ExitActions>
|
</MultiTrigger.ExitActions>
|
||||||
</MultiTrigger>
|
</MultiTrigger>
|
||||||
<!--<Trigger Property="IsMouseOver" Value="True">
|
|
||||||
<Setter Property="Background" Value="#FFE4DBDB"/>
|
|
||||||
</Trigger>-->
|
|
||||||
<Trigger Property="IsSelected" Value="true">
|
<Trigger Property="IsSelected" Value="true">
|
||||||
<Setter Property="Background" Value="#FFECECEC"/>
|
<Setter Property="Background" Value="#FFECECEC"/>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
<cvt:MenuWidthConvert x:Key="MenuWidthConvert"/>
|
||||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!--左侧栏-->
|
<!--左侧栏-->
|
||||||
<hc:Card x:Name="MyCard"
|
<hc:Card x:Name="MyCard"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Effect="{DynamicResource EffectShadow2}"
|
Effect="{DynamicResource EffectShadow2}"
|
||||||
Margin="5,0,0,5"
|
Margin="5,0,0,5"
|
||||||
>
|
>
|
||||||
<hc:Card.Background>
|
<hc:Card.Background>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
<SolidColorBrush Color="#FFFFFFFF" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}">
|
||||||
|
|
||||||
</SolidColorBrush>
|
</SolidColorBrush>
|
||||||
</hc:Card.Background>
|
</hc:Card.Background>
|
||||||
<hc:Card.BorderBrush>
|
<hc:Card.BorderBrush>
|
||||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||||
</hc:Card.BorderBrush>
|
</hc:Card.BorderBrush>
|
||||||
<hc:Card.ContextMenu>
|
<hc:Card.ContextMenu>
|
||||||
<ContextMenu Width="200">
|
<ContextMenu Width="200">
|
||||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:Card.ContextMenu>
|
</hc:Card.ContextMenu>
|
||||||
<WrapPanel Orientation="Horizontal">
|
<WrapPanel Orientation="Horizontal">
|
||||||
<ListBox x:Name="MenuListBox"
|
<ListBox x:Name="MenuListBox"
|
||||||
|
Padding="2,3,0,2"
|
||||||
ItemsSource="{Binding MenuList}"
|
ItemsSource="{Binding MenuList}"
|
||||||
Tag="{Binding AppConfig.MenuCardWidth}"
|
Tag="{Binding AppConfig.MenuCardWidth}"
|
||||||
BorderThickness="0" Foreground="{x:Null}"
|
BorderThickness="0" Foreground="{x:Null}"
|
||||||
@@ -84,48 +83,49 @@
|
|||||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
SelectionChanged="menus_SelectionChanged"
|
SelectionChanged="menus_SelectionChanged"
|
||||||
>
|
>
|
||||||
<ListBox.Resources>
|
<ListBox.Resources>
|
||||||
<ContextMenu x:Key="MenuDialog" Width="200">
|
<ContextMenu x:Key="MenuDialog" Width="200">
|
||||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||||
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
<MenuItem Header="重命名" Click="RenameMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
<MenuItem Header="修改图标" Click="EditMenuGeometry" Tag="{Binding}"/>
|
||||||
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
<MenuItem Header="删除" Click="DeleteMenu" Tag="{Binding}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
|
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource MenuStyle}">
|
||||||
<Setter Property="ContextMenu" Value="{StaticResource MenuDialog}"/>
|
<Setter Property="ContextMenu" Value="{StaticResource MenuDialog}"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
<ListBox.Background>
|
<ListBox.Background>
|
||||||
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
<SolidColorBrush Color="AliceBlue" Opacity="0"/>
|
||||||
</ListBox.Background>
|
</ListBox.Background>
|
||||||
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="33" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=10}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
<DraggAnimatedPanel:DraggAnimatedPanel ItemsHeight="33" ItemsWidth="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=10}" HorizontalAlignment="Center" VerticalAlignment="Top" SwapCommand="{Binding SwapCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
<StackPanel MouseLeftButtonDown="MenuClick" MouseRightButtonDown="MenuClick" Tag="{Binding}">
|
||||||
<hc:TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
<TextBox Text="{Binding Path=MenuName, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1},Path=Tag, Mode=TwoWay, Converter={StaticResource MenuWidthConvert}, ConverterParameter=35}"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Height="25"
|
Height="28"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
TextAlignment="Left"
|
TextAlignment="Left"
|
||||||
LostFocus="LostFocusOrEnterDown"
|
LostFocus="LostFocusOrEnterDown"
|
||||||
KeyDown="LostFocusOrEnterDown"
|
KeyDown="LostFocusOrEnterDown"
|
||||||
Tag="{Binding}"
|
Tag="{Binding}"
|
||||||
Margin="2"
|
Padding="2"
|
||||||
|
BorderThickness="0"
|
||||||
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
IsVisibleChanged="MenuEditWhenVisibilityChanged"
|
||||||
Visibility="{Binding MenuEdit}"/>
|
Visibility="{Binding MenuEdit}"/>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Button Background="Transparent"
|
<Button Background="Transparent"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
hc:IconElement.Geometry="{Binding MenuGeometry}"
|
||||||
hc:IconElement.Height="18"
|
hc:IconElement.Height="18"
|
||||||
@@ -134,18 +134,18 @@
|
|||||||
Opacity="1"
|
Opacity="1"
|
||||||
Foreground="{Binding GeometryColor}"
|
Foreground="{Binding GeometryColor}"
|
||||||
/>
|
/>
|
||||||
<TextBlock Text="{Binding MenuName}"
|
<TextBlock Text="{Binding MenuName}"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsVisibleChanged="MenuWhenVisibilityChanged"
|
IsVisibleChanged="MenuWhenVisibilityChanged"
|
||||||
Visibility="{Binding NotMenuEdit}"
|
Visibility="{Binding NotMenuEdit}"
|
||||||
/>
|
/>
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</StackPanel>
|
||||||
</ListBox.ItemTemplate>
|
</DataTemplate>
|
||||||
</ListBox>
|
</ListBox.ItemTemplate>
|
||||||
</WrapPanel>
|
</ListBox>
|
||||||
</hc:Card>
|
</WrapPanel>
|
||||||
|
</hc:Card>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
Reference in New Issue
Block a user