向 silverlight 4 控件添加属性以添加功能
我很好奇如何添加属性来向控件添加功能。目前我只是扩展控件,但我很好奇是否可以添加属性来向控件添加功能。例如 ToolTipService。您可以将其添加到控件中。我是否可以添加一个属性来添加上下文菜单,而不必扩展文本框呢?我了解行为,但是可以将其作为财产吗?假设我添加一个属性 IsContextMenuBehaviorAdded="True" ,它只会附加一个行为,或者只是添加功能。任何帮助将不胜感激。提前致谢。
I am curious how I can add a property to add functionality to a control. Currently I am just extending controls, but I was curious if it is possible to add a property to add functionality to a control. Like for example the ToolTipService. You can add that to controls. Would it be possible for me to add a property to add a contextmenu without having to extend a textbox lets say? I know about behaviors, but is it possible to do that as a property? Let's say I add a property IsContextMenuBehaviorAdded="True" and that will just attach a behavior, or just add functionality. Any help would be greatly appreciated. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望向控件添加上下文菜单,则可以使用Silverlight Toolkit 其中包含一个 ContextMenuService 。
If you are looking to add a context menu to a control then you can do that with the Silverlight Toolkit which contains a
ContextMenuService
.