Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top