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.
精彩评论