How to prevent clicks from passing through a control to the one below it

前端 未结 3 1192
挽巷
挽巷 2021-01-18 13:46

I have a textbox in a groupbox, both with double click events. When I double click in the textbox both events are triggered.

How do I stop clicks in the textbox from

3条回答
  •  离开以前
    2021-01-18 14:25

    Because WPF uses a "tunneling / bubbling" model of event propagation, most events begin bubbling UP from the bottom of the visual tree. If you want to catch an event on the way down, there are Preview versions of the events that tunnel downwards. For example:

    PreviewMouseDoubleClick

    Set e.Handled = true in there.

提交回复
热议问题