title: Handling the same click event in a nested control inside ListBoxItem DataTemplate - WPF
body: <p>When we have a custom listbox with a defined event-handling for the left-click of the mouse, and also an additional shape inside the ListBoxItem data template which needs to do some action when it is clicked how can we handle these </p>
  
  <p>I have a Custom ListBox witch tries to handle the Click event :</p>
  
  <p><strong>In the ContentView:</strong></p>
  
  <pre><code>                &lt;ABC:AListBox
                      ClickCommand="{Binding LaunchCommand}"
                      ...&gt;
                  &lt;/ABC:AListBox&gt;
  </code></pre>
  
  <p><strong>In it's datatemplate we have this:</strong></p>
  
  <pre><code>        &lt;DataTemplate x:Key="ThisListTemplate"&gt;
              &lt;StackPanel ...&gt;
                  &lt;Border Grid.Column="1" VerticalAlignment="Center"&gt;
                      &lt;TextBlock
                          FontSize="15"
                          Foreground="White"
                          Text="{Binding Path=ItemTitle}" /&gt;      
                  &lt;/Border&gt;
                  &lt;Canvas Height ="12" Width ="12" &gt;
                    &lt;Ellipse Name = "TheEllipse" Stroke="Black" Height ="12"                                  
                             Width ="12" Cursor="Hand" Canvas.Left="185" Canvas.Top="12"&gt;                          
                    &lt;/Ellipse&gt;
                      &lt;Ellipse.InputBindings&gt;
                          &lt;MouseBinding Gesture="LeftClick"
                                        Command="{Binding DataContext.LaunchFromXamlCommand , RelativeSource={RelativeSource AncestorType=ABC:AListBox}}"
                                        CommandParameter="{Binding}" /&gt;
                      &lt;/Ellipse.InputBindings&gt;                      
                  &lt;/Canvas&gt; 
              &lt;/StackPanel&gt;                   
          &lt;/DataTemplate&gt;
  </code></pre>
  
  <p><strong>And in the MVVM as our data context we have:</strong></p>
  
  <pre><code>    public ICommand LaunchCommand { get; private set; }
      public DelegateCommand&lt;object&gt; LaunchFromXamlCommand { get; private set; }
  
      // Initialization on load:
  
      this.LaunchCommand = new DelegateCommand(this.LaunchRun);
      this.LaunchFromXamlCommand = new DelegateCommand&lt;object&gt;(this.LaunchFromXamlRun);
  
  
      //---------     
      private void LaunchFromXamlRun(object param)
      {
              TheListItem app = (TheListItem)param;   
      ...
      }   
  
      private void LaunchRun()
      { ... }
  </code></pre>
  
  <p>Here I used 2 different commands LaunchCommand as an ICommand in addition with LaunchFromXamlCommand which is called via the template.</p>
  
  <p>The <code>LaunchFromXamlRun</code> will get triggered fine and as expected.
  But also as it can be guessed there will be 2 raised events and 2 commands getting triggered which I want to omit one and ignore the general ListBox event handler when that shape is get hit.</p>
  
  <p>What can be the best solution for doing this?</p>
  
  <p><strong>FYI:</strong> <em>(Maybe not so important just for a note)</em> The App is using earlier versions of Prism (don't think that matters here) and has a modular code, everything is separated in different assemblies and the code is using MVVM pattern.</p>
  
  <p>I wish we had something like <code>e.handled = true</code> in a mechanism that could be used in the given scenario.</p>