禁用 Windows Phone 工具包中的 MenuItem
我想禁用 contextMenu 中的一些菜单项,但不是全部。
<tk:ContextMenuService.ContextMenu>
<tk:ContextMenu Name="optionMenu">
<tk:MenuItem Header="Move to Favorite" Name="moveToFav" Click="moveToFav_Click" />
<tk:MenuItem Header="Copy to Favorite" Name="copyToFav" Click="copyToFav_Click" />
<tk:MenuItem Header="Set as Folder Front" Name="setFront" Click="setFront_Click" />
<tk:MenuItem Header="Delete" Name="delete" Click="delete_Click" />
</tk:ContextMenu>
</tk:ContextMenuService.ContextMenu>
例如,我想禁用 moveToFav、copyToFav MenuItem,我尝试
moveToFav.isEnabled = false; copyToFav.isEnable = false;
但它不起作用,因为编译器说 moveToFav 在当前上下文中不存在。
有帮助吗?
I want to disable some menuItems in a contextMenu, but not all of them.
<tk:ContextMenuService.ContextMenu>
<tk:ContextMenu Name="optionMenu">
<tk:MenuItem Header="Move to Favorite" Name="moveToFav" Click="moveToFav_Click" />
<tk:MenuItem Header="Copy to Favorite" Name="copyToFav" Click="copyToFav_Click" />
<tk:MenuItem Header="Set as Folder Front" Name="setFront" Click="setFront_Click" />
<tk:MenuItem Header="Delete" Name="delete" Click="delete_Click" />
</tk:ContextMenu>
</tk:ContextMenuService.ContextMenu>
for example, I want to disable moveToFav, copyToFav MenuItem, I try to
moveToFav.isEnabled = false; copyToFav.isEnable = false;
But It didn't work because the compiler said moveToFav doesn't exist in the current context.
Any Help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
执行以下操作
好吧,我决定在代码中
:它并不完美,但它有效
well, I decided to do the following
in the code:
it's not perfect, but it works