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.

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top