Replies: 1 comment 6 replies
-
I realize I can just use the preview events to execute stuff before the class's handler. But I still would find an answer to my question interesting. More generally, being able to programmatically modify the template that is about to get applied would be great. At the moment, it feels to me like the promise of being able to customize a control's appearance using templates is fulfilled in name only. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have implemented an autocomplete behaviour for textboxes which works by overriding OnTextInput and OnKeyDown. I can't just subscribe to events because I need to perform stuff before the textbox's built in handlers.
Now I would like to plug this behaviour into the editable part of a combobox. That would require me to force the template of the combobox to create an instance of my derived textbox instead of the vanilla textbox. What would be the easiest way of doing that?
PS: I have devised an alternative way to overriding OnTextInput and OnKeyDown, but it's horrifying: I add to TextBox a class handler for the corresponding events and it gets executed before the handler installed by UIElement, but of course it will affect all textboxes and not just the ones I want to plug my behaviour into (I work around that by setting on the textboxes I want to autocomplete a special property value that I test in the class handler). I'd very much like to avoid using that method.
Beta Was this translation helpful? Give feedback.
All reactions