1、使用 Icon.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Geometry x:Key="Icon-Close">M583.168 523.776L958.464 148.48c18.944-18.944 18.944-50.176 0-69.12l-2.048-2.048c-18.944-18.944-50.176-18.944-69.12 0L512 453.12 136.704 77.312c-18.944-18.944-50.176-18.944-69.12 0l-2.048 2.048c-19.456 18.944-19.456 50.176 0 69.12l375.296 375.296L65.536 899.072c-18.944 18.944-18.944 50.176 0 69.12l2.048 2.048c18.944 18.944 50.176 18.944 69.12 0L512 594.944 887.296 970.24c18.944 18.944 50.176 18.944 69.12 0l2.048-2.048c18.944-18.944 18.944-50.176 0-69.12L583.168 523.776z</Geometry> </ResourceDictionary>
2、引入 Icon.xaml
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary /> <ResourceDictionary Source="pack://application:,,,/FrameWork.Core;component/icon/Icon.xaml"> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> <Application.Resources>
3、使用
<Menu Background="Transparent" Margin="2" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Left"> <MenuItem Header="文件"> <MenuItem Header="关闭" Command="{Binding CreateTemplateCommand}"> <MenuItem.Icon> //使用 <Path Data="{DynamicResource Icon-Close}" Margin="0 0 0 0" Width="15" Height="15" Stretch="Fill" Cursor="Hand" Fill="{DynamicResource Nb.Win.Foreground}" /> </MenuItem.Icon> </MenuItem> </MenuItem> </Menu>