Search code examples
c#wpfeventstarget

Target of Event C#


What is meant by the Target of an Event in C# WPF? Does it mean it is the object on which the event was fired or something else? Please Correct me.

Thank you in advance.


Solution

  • Yes, if you are referring to routed input events such as KeyDown and PreviewKeyDown, the target element is the element that receives the input such as for example a TextBox.

    Preview events tunnel down the element tree from the root element of the element tree to the target (input) element. Bubbling events bubble up from the target element to the root element.