I want to raise events from a user control and no matter how much I read up on routed events in WPF I just can't seem to get my head totally around them.
I've just about figured out how to raise an event from a user control and handle that event in the parent window but in one particular scenario the user control is actually contained within another user control which is then contained within a parent window. Is it a case of raising the event in the user control, catching it in the parent user control and raising it again to be caught in the parent window?
Also, I've been using code similar to the below; what does this do? The reason I ask is that my events still seem to fire if I comment this out so I'm not sure what the purpose of this is
Public Custom Event PaymentDetailsChanged As PaymentDetailsChangedHandler
AddHandler(ByVal value As PaymentDetailsChangedHandler)
Me.AddHandler(PaymentDetailsChangedEvent, value)
End AddHandler
RemoveHandler(ByVal value As PaymentDetailsChangedHandler)
Me.RemoveHandler(PaymentDetailsChangedEvent, value)
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As PaymentDetailsChangedArgs)
Me.RaiseEvent(e)
End RaiseEvent
End Event
Any suggestions of what I should actually be doing would be great, code examples preferably in VB.Net
Our community of experts have been thoroughly vetted for their expertise and industry experience.