Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.control.mousedoubleclick.aspx" rel="nofollow">Control.MouseDoubleClick</a> is not a bubble event but a direct event.</strong></p> <p>Since checking this question with <a href="http://snoopwpf.codeplex.com/" rel="nofollow">Snoop</a>, which is a tool for browsing visual trees and routed events, I see that <code>Control.MouseDoubleClick</code> events of 'ListView' and 'ListBoxItem' are fired at one time. You could check with this Snoop tool.</p> <hr> <p>First, to find an answer, it is needed to check that both event arguments of the <code>MouseDoublClick</code> are same objects. You would expect they are same objects. If it is true, it is very strange as your question, but they are not same instances. We can check it with following codes.</p> <pre><code>RoutedEventArgs _eventArg; private void Button_MouseDoubleClick(object s, RoutedEventArgs e) { if (!e.Handled) Debug.WriteLine("Button got unhandled doubleclick."); //e.Handled = true; _eventArg = e; } private void ListViewItem_MouseDoubleClick(object s, RoutedEventArgs e) { if (!e.Handled) Debug.WriteLine("ListViewItem got unhandled doubleclick."); e.Handled = true; if (_eventArg != null) { var result = _eventArg.Equals(e); Debug.WriteLine(result); } } </code></pre> <p>It means that the event argument of the <code>MouseDoublClick</code> is created newly at somewhere, but I don't understand deeply why it is. </p> <p>To be clearer, let's check for the event argument of the <code>BottonBase.Click</code>. It will be return the true about checking same instances.</p> <pre><code> &lt;ListView&gt; &lt;ListViewItem ButtonBase.Click="ListViewItem_MouseDoubleClick"&gt; &lt;Button Click="Button_MouseDoubleClick" Content="click"/&gt; &lt;/ListViewItem&gt; &lt;/ListView&gt; </code></pre> <p>If you only focus on the execution as you mentioned there'll be lots of solutions. As above, I think that using the flag(<code>_eventArg</code>) is also good choice.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload