Replies: 1 comment 2 replies
-
@trebahl How about show your ideas code? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I often find a need to execute code after a template has been applied, for instance to slightly alter what has been generated by the default template, or just for debuging purposes. I make do by defining a derived class overriding OnApplyTemplate, but having an event to do the same thing would be more versatile.
A case where an event would be orders of magnitude more convenient: say the template of a control A generates a control B and I want to plug into B's OnApplyTemplate. I can't override B's OnApplyTemplate since I didn't call its constructor (and I don't want to copy-paste the whole xaml of A to modify it). The best workaround I have found is to plug into A's OnApplyTemplate (which I can control because I am creating A from code), extract B and call its ApplyTemplate immediately, then apply the tweak and pray it doesn't get undone later.
Beta Was this translation helpful? Give feedback.
All reactions