It can be done by routed events on you user control that rise buttons click event handler or by using commands. This is probably a same case as yours
WPF Handlers for user control sub-controls
-
30-05-2022 - |
Question
I have defined a user control to represent a tab item comprising of a few buttons. When I create an instance of the user tab item I would like to define click handlers for button clicks. e.g. for
<TabItem > <my:Tab1/> </TabItem>
For Button1 and Button2 within Tab1 I would like to define something like
<TabItem > <my:Tab1 Button1:Click="button1_Click" Button2:Click="button2_Click"/> </TabItem>
Naturally, the above doesn't work. Does anyone know how I can achieve this.
Thanks in advance.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow