事件属性句柄 [英] Event Property Handle

查看:69
本文介绍了事件属性句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用wpf为usercontrol中的事件属性分配值?

how to assign value to events property in usercontrol using wpf?

推荐答案

您不能这样做,这是有充分理由的.这不是事件的工作方式;这是永远不需要的.通常,由于事件具有防呆功能,因此它们是非常有限的对象.您甚至不能在声明它的类之外的任何地方引发事件,即使在派生类中也是如此.您所能做的就是使用"+ ="和(很少)使用-="运算符.

如果您不知道它是什么,则需要阅读有关委托的知识,而不是.NET中的事件.由于您没有与我们分享您的目标,因此您可以立即获得所有帮助.

—SA
You cannot to it, for a good reason. This is not how events work; this is never needed. In general, events are very limiting objects, thanks to their fool-proof features. You cannot even raise an event nowhere outside the class where it is declared, not even in derived class. All you can do is using "+=" and (rarely) "-=" operators.

If you do not know what it is, you need to read about delegates and than about events in .NET. As you did not share your purpose with us, that''s all help you can get for now.

—SA


这篇关于事件属性句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆