I am just going through the WPF concepts I came across these routed events ,dependency properties and attached events.
I think I am not able to understand the concepts behind them and why they were being called in the place of .net originated methods?
I am just going through the WPF concepts I came across these routed events
Share
Routed Events provide the ability for different controls in the element tree to react to events.
For instance, if we have a
Windowcontaining aStackPanelcontaining aButtonand someone presses the mouse key on the button, the events will be fired in this order:These “preview” events use a behavior called
Tunneling. The normal eventsBubbleup again.If you set the
Handledproperty of theEventArgstotrue, the tunneling and bubbling will stop. Tunneling or Bubbling is called the Routing Strategy.This enables handling a variety of situations, for instance:
HandledtotrueonStackPanel.PreviewMouseDown).Window.KeyDown)I would advise not looking into Attached Events untill this becomes absolutely necessary. The scenario’s for attached events are very limited. Attached events are also routed events.