开发者

RegisterClassHandler vs. AddHandler In WPF Custom Control

开发者 https://www.devze.com 2023-03-21 13:39 出处:网络
When writing a WPF custom control, there is sometime the need to capture child elements events in order to implement some logic.

When writing a WPF custom control, there is sometime the need to capture child elements events in order to implement some logic.

One alternative is to hook to events in OnApp开发者_运维百科lyTemplate (and unhook in OnTemplateChanged).

Another alternative is to use RegisterClassHandler in a static constructor.

What are the pros and cons for each alternative?

Thanks.

0

精彩评论

暂无评论...
验证码 换一张
取 消