添加 自定义菜单图标
This commit is contained in:
45
Control/UserControls/IconFont/IconPannel.xaml
Normal file
45
Control/UserControls/IconFont/IconPannel.xaml
Normal file
@@ -0,0 +1,45 @@
|
||||
<UserControl x:Class="GeekDesk.Control.UserControls.IconFont.IconPannel"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.IconFont"
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<ListBox x:Name="IconfontList" ItemsSource="{Binding}" BorderThickness="0" Background="AliceBlue">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" Background="Transparent"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Tag="{Binding}" Width="80" Height="80">
|
||||
<Button Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsEnabled="False"
|
||||
Opacity="0.8"
|
||||
hc:IconElement.Geometry="{Binding Text}"
|
||||
hc:IconElement.Height="35"
|
||||
hc:IconElement.Width="35"
|
||||
Height="60"
|
||||
Width="60"
|
||||
/>
|
||||
<TextBlock TextAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Width="100" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</WrapPanel>
|
||||
</UserControl>
|
||||
29
Control/UserControls/IconFont/IconPannel.xaml.cs
Normal file
29
Control/UserControls/IconFont/IconPannel.xaml.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls.IconFont
|
||||
{
|
||||
/// <summary>
|
||||
/// IconPannel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class IconPannel : UserControl
|
||||
{
|
||||
public IconPannel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -55,13 +55,15 @@
|
||||
<cvt:OpcityConvert x:Key="OpcityConvert"/>
|
||||
</UserControl.Resources>
|
||||
<!--左侧栏-->
|
||||
<hc:Card
|
||||
<hc:Card x:Name="MyCard"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,0,5"
|
||||
>
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="#FFFFFFFF" 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>
|
||||
</hc:Card.Background>
|
||||
<hc:Card.BorderBrush>
|
||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||
@@ -131,8 +133,9 @@
|
||||
</Canvas>
|
||||
</Button>-->
|
||||
<!--<TextBlock Text="" Style="{StaticResource MyIcon}"/>-->
|
||||
<TextBlock Text="" FontFamily="/#IconFont" FontSize="40"/>
|
||||
<TextBlock Text="{Binding MenuName}"
|
||||
HorizontalAlignment="Center"
|
||||
TextAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsVisibleChanged="MenuWhenVisibilityChanged"
|
||||
Visibility="{Binding NotMenuEdit}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using DraggAnimatedPanelExample;
|
||||
using GeekDesk.Control.Windows;
|
||||
using GeekDesk.Util;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
@@ -13,6 +14,7 @@ using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Effects;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
@@ -31,6 +33,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
{
|
||||
InitializeComponent();
|
||||
appData.AppConfig.SelectedMenuIcons = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
|
||||
|
||||
}
|
||||
|
||||
DelegateCommand<int[]> _swap;
|
||||
@@ -190,7 +193,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
||||
/// <param name="e"></param>
|
||||
private void EditMenuGeometry(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||
IconfontWindow.Show(SvgToGeometry.GetIconfonts(), menuInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
Effect="{DynamicResource EffectShadow2}"
|
||||
Margin="5,0,5,5" Grid.ColumnSpan="2">
|
||||
<hc:Card.Background>
|
||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
<SolidColorBrush Color="AliceBlue" hc:GeometryEffect.GeometryEffect="20" Opacity="{Binding AppConfig.CardOpacity, Mode=TwoWay, Converter={StaticResource OpcityConvert}}"/>
|
||||
</hc:Card.Background>
|
||||
<hc:Card.BorderBrush>
|
||||
<SolidColorBrush Color="#FFFFFFFF" Opacity="0"/>
|
||||
|
||||
Reference in New Issue
Block a user