DataGrid 的上下文菜单
我有以下数据网格行的上下文菜单。
<ContextMenu x:Key="cm_rowMenu">
<!--ContextMenu For Row-->
<MenuItem Header="Edit Info."
Click="mnuEditInfo_Click"
/>
<MenuItem Header="Delete"
Click="mnuDeleteDevSoftware_Click"
/>
<MenuItem Header="Check In"
Click="mnuCheckIn_Click"
/>
</ContextMenu>
<Style x:Key="DefaultRowStyle" TargetType="{x:Type dg:DataGridRow}">
<Setter Property="ContextMenu" Value="{StaticResource cm_rowMenu}" />
</Style>
但是,我想进行以下更改:
我希望根据 dataGrid.SelectedItem 的属性启用/禁用菜单项。我该怎么做?
此致, 麦德塞布
I have the following context menu for rows of the Data Grid.
<ContextMenu x:Key="cm_rowMenu">
<!--ContextMenu For Row-->
<MenuItem Header="Edit Info."
Click="mnuEditInfo_Click"
/>
<MenuItem Header="Delete"
Click="mnuDeleteDevSoftware_Click"
/>
<MenuItem Header="Check In"
Click="mnuCheckIn_Click"
/>
</ContextMenu>
<Style x:Key="DefaultRowStyle" TargetType="{x:Type dg:DataGridRow}">
<Setter Property="ContextMenu" Value="{StaticResource cm_rowMenu}" />
</Style>
However, I want to make the following change:
I want the menu items to be enabled/disabled based on properties of the dataGrid.SelectedItem. How do I do this ?
Best regards,
MadSeb
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用命令:
行模型:
Use commands:
Model for rows: