nerdexam
Microsoft

70-511 · Question #235

70-511 Question #235: Real Exam Question with Answer & Explanation

The correct answer is B. Programmatically add an event handler to the parent control and set the HandledEventsToo. For most common handler scenarios, marking an event as handled by setting Handled to true will "stop" routing for either a tunneling route or a bubbling route, and also for any event that is handled at a point in the route by a class handler. However, there is a "handledEventsToo

Question

You are developing a Windows Presentation Foundation (WPF) application. A user control responds to a click event. The click event handler sets the Handled property to True. You need to ensure that a parent control responds to the event after the user control's handler executes. What should you do?

Options

  • AAdd a bubbling routed event handler to the parent control.
  • BProgrammatically add an event handler to the parent control and set the HandledEventsToo
  • CAdd a tunneling routed event handler to the parent control.
  • DProgrammatically add an event handler to the parent control and set the HandledEventsToo

Explanation

For most common handler scenarios, marking an event as handled by setting Handled to true will "stop" routing for either a tunneling route or a bubbling route, and also for any event that is handled at a point in the route by a class handler. However, there is a "handledEventsToo" mechanism whereby listeners can still run handlers in response to routed events where Handled is true in the event data. In other words, the event route is not truly stopped by marking the event data as handled. You can only use the handledEventsToo mechanism in code, or in an EventSetter:

Community Discussion

No community discussion yet for this question.

Full 70-511 Practice