c# - Calling parent UserControl method from a child UserControl in Silverlight -


I have a C # Silverlight Application This application has a UserControl with a 2x2 grid. Each of the cells in the grid has a UserControl; Each of these children has a button in the UserControl elements when a user clicks the button in a child, then I want to execute a method that is in the parent user control, then the other Sends information to three children. How do i do this

Thank you!

If you are using binding, you tie a model to the following model such as master control datacentext Action: Action for class MasterViewModel {/// Child User Control 1 Zero DoUserControlAction1 () {// //. .} /// Action for Child User Control 2 zero zero DoUserControlAction2 () {// ...} // ... / Action for Child User Control n zero DoSuserControlActionN () {// ...}} < / Code>

Then each child is in control, as its datacontact is derived from the parent data control of the parent user control: class UserControl1 {public void HandleButtonClick (Object Sender, EventEurge E) {(MasterView Model) Datacou Tekst). Do User Control Actions 1 (); }}

This logic should be in the visual modal that you are bound to master control.

If you do not have the compulsion, you can always add the event. Control the child and bubble them in master control and handle it there.

Comments