[英]icon in datagrid context menu don't work
I am trying to add an icon to a datagrid context menu however altough I added the file to the folder and changed it to copy always. 我试图在数据网格上下文菜单中添加一个图标,但是尽管如此,我还是将文件添加到了文件夹中并将其更改为始终复制。
The context menu do not show the photo. 上下文菜单不显示照片。 insted he write the photo path:"Delete-icon.ico" would be happy for an answer thanks,
他安装了照片路径:“ Delete-icon.ico”将很乐意回答,谢谢,
<DataGrid x:Name="DGData" Grid.Column="2" PreviewKeyDown="DGData_PreviewKeyDown" IsReadOnly="True">
<DataGrid.Columns>
</DataGrid.Columns>
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem Header="Delete" Click="MenuItem_Click" Icon="Delete-icon.ico"></MenuItem>
</ContextMenu>
</DataGrid.ContextMenu>
</DataGrid>
Set the Icon
property to an Image
: 将
Icon
属性设置为Image
:
<MenuItem Header="Delete" Click="MenuItem_Click">
<MenuItem.Icon>
<Image Source="Delete-icon.ico" />
</MenuItem.Icon>
</MenuItem>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.