为什么没有人为 Winforms 编写 RadioMenuItems 类?
或者也许谷歌对我不太友好?
我想要的是这个简单的事情:
- 接受菜单项对象数组的构造函数
- Value get/set 属性,该属性将设置所有 Checked 属性,正确
- 绑定到所提供项目的所有 Clicked 事件,并提供一个事件
- 工作 DataBind 设施
如果您遇到这样的情况周围有一件好事,请指导我。请不需要手动 do-it-in-your-form1.cs-class 链接。这个我自己可以做。
Or maybe google is just not so friendly to me?
What I want is this simple thing:
- constructor that accepts an array of menu item objects
- Value get/set property that would set all the Checked properties right
- bind to all Clicked events of the supplied items and provide One event
- Working DataBind facilities
If you encountered such a nice thing around, please direct me. No need for manual do-it-in-your-form1.cs-class links, please. This I can do myself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅:http://msdn.microsoft.com/en-us/library/ ms404318.aspx
摘要:您必须创建一个新的 ToolStripMenuItem 子类来重写 OnCheckChanged、OnOwnerChanged 和可能的 OnPaint 方法。
请注意,在我们的示例中,我们保留 UI 的复选标记而不是单选按钮。但保留专有的勾选功能。
See: http://msdn.microsoft.com/en-us/library/ms404318.aspx
Summary: You'll have to make a new ToolStripMenuItem subclass that overrides the OnCheckChanged, OnOwnerChanged, and possibly OnPaint methods.
Note that in our case, we keep the check mark for the UI rather than a radio button. But keep the exclusive tick functionality.
好的,这是我的最终代码。它可以做其他一个不做的事情(支持绑定),反之亦然。也许可以结合起来。随意使用。
OKay, here's my final code. It does something the other one doesn't (Supports binding), and vice versa. Perhaps one could combine. Use at your pleasure.