Edit: You need to raise an event , as well as read the review .
If your event is publicly available, you can subscribe to it from almost anywhere:
In XAML:
<StackPanel> <local:MyControl MyEvent="MyControl_OnMyEvent"/>
In the corresponding *.xaml.cs :
private void MyControl_OnMyEvent(object sender, EventArgs e) {
Change the type of arguments as necessary.
If the event is routed , you can also subscribe to it in the StackPanel :
<StackPanel local:MyControl.MyEvent="MyControl_OnMyEvent">
This allows you to handle the event of all MyControl children in one place without adding a handler to each instance.
source share