title: Prism command binding not executing
body: <p>in my project i used wpf + prism.Inside a view,i must invoke a command inside a context menu, the command is defined into the viewmodel class.this is the view:</p>
  
  <pre><code>&lt;UserControl x:Class="GrigoLync.Modules.LyncClient.Contatti.ContattiView"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
           xmlns:infr="clr-namespace:GrigoLync.infrastructure.Model.Lync;assembly=GrigoLync.infrastructure"
           xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
           xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
           mc:Ignorable="d"
           d:DesignHeight="300" d:DesignWidth="300" 
  
           &gt;
  
  &lt;Grid&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="*" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Label Grid.Column="0" Grid.Row="0" FontSize="12" Margin="5"&gt;Contatti&lt;/Label&gt;
  
      &lt;TreeView x:Name="groupTreeView" Margin="10" ItemsSource="{Binding GruppiLync}" &gt;
          &lt;TreeView.ItemTemplate&gt;
              &lt;HierarchicalDataTemplate ItemsSource="{Binding Path=ContattiLync}"&gt;
                  &lt;TextBlock Text="{Binding Path=Nome}" /&gt;
                  &lt;HierarchicalDataTemplate.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;TextBlock Text="{Binding Path=Uri}" Tag="{Binding}"&gt;
                          &lt;TextBlock.ContextMenu&gt;
                              &lt;ContextMenu&gt; 
                                  &lt;MenuItem Header ="Invia messaggio istantaneo" 
                                            Command="{Binding PlacementTarget.Tag.SendInstantMessageCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, diag:PresentationTraceSources.TraceLevel=High}"/&gt;                                         
                              &lt;/ContextMenu&gt;
                          &lt;/TextBlock.ContextMenu&gt;
                          &lt;/TextBlock&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/HierarchicalDataTemplate.ItemTemplate&gt;
              &lt;/HierarchicalDataTemplate&gt;
          &lt;/TreeView.ItemTemplate&gt;
      &lt;/TreeView&gt; 
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>the following is the viewmodel class:</p>
  
  <pre><code> [Export(typeof(ContattiViewModel))]
  [PartCreationPolicy(CreationPolicy.Shared)]
  public class ContattiViewModel : NotificationObject
  {
  
      private readonly ILyncClientService lyncClientService;
      private readonly IRegionManager regionManager;
      private readonly IEventAggregator eventAggregator;
      private List&lt;GruppoLync&gt; gruppiLync;
      private ICommand sendInstantMessageCommand;
  
  
  
       [ImportingConstructor]
      public ContattiViewModel(ILyncClientService lyncClientService, IRegionManager regionManager, IEventAggregator eventAggregator)
      {
          if (lyncClientService == null)
          {
              throw new ArgumentNullException("lyncClientService");
          }
  
          if (regionManager == null)
          {
              throw new ArgumentNullException("regionManager");
          }
  
          if (eventAggregator == null)
          {
              throw new ArgumentNullException("eventAggregator");
          }
  
          this.lyncClientService = lyncClientService;
          this.regionManager = regionManager;
          this.eventAggregator = eventAggregator;
          this.gruppiLync = lyncClientService.elencoGruppiLync();
          this.sendInstantMessageCommand = new DelegateCommand&lt;object&gt;(this.SendInstantMessage);
  
          //groupTreeView.DataItems = this.gruppiLync;
  
       }
  
       public ICommand SendInstantMessageCommand { get { return this.sendInstantMessageCommand; } }
       public List&lt;GruppoLync&gt; GruppiLync
       {
           get
           {
               return this.gruppiLync;
           }             
       }
  
       private void SendInstantMessage(object aContattoLync)
       {
           //This point is not executed!
       }
  
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>When i select from the user interface the menu item "Invia Messaggio istantaneo" the command is not invoke, This point is not executed
  can help me please?!!!!<br/>
  this is the GruppoLync class:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.ComponentModel;
  using System.Collections.ObjectModel;
  
  namespace GrigoLync.infrastructure.Model.Lync
  {
  public class GruppoLync : INotifyPropertyChanged
  {
      private string nome;
      public string Nome
      {
          get { return nome; }
  
          set { nome = value;
          OnPropertyChanged(new PropertyChangedEventArgs("Nome"));
  
          }
      }
  
      private ObservableCollection&lt;ContattoLync&gt; contattiLync;
      public ObservableCollection&lt;ContattoLync&gt; ContattiLync
      {
          get { return contattiLync; }
          set
          {
              contattiLync = value;
              OnPropertyChanged(new PropertyChangedEventArgs("ContattiLync"));
          }
      }
  
      public event PropertyChangedEventHandler PropertyChanged;
      public void OnPropertyChanged(PropertyChangedEventArgs e)
      {
          if (PropertyChanged != null)
              PropertyChanged(this, e);
      }
  
      public GruppoLync(string nome, ObservableCollection&lt;ContattoLync&gt; contattiLync)
      {
          Nome = nome;
          ContattiLync = contattiLync;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this is ContattoLync class:<br/></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Windows.Input;
  using Microsoft.Practices.Prism.Commands;
  
  namespace GrigoLync.infrastructure.Model.Lync
  {
  public class ContattoLync
  {
  
      public string Uri { get; set; }
      public string Stato { get; set; }
  
  }
  }
  </code></pre>
  
  <p>I report also the trace log of the binding:</p>
  
  <pre><code>System.Windows.Data Warning: 54 : Created BindingExpression (hash=37997052) for Binding (hash=17879784)
  System.Windows.Data Warning: 56 :   Path: 'PlacementTarget.Tag.SendInstantMessageCommand'
  System.Windows.Data Warning: 58 : BindingExpression (hash=37997052): Default mode resolved to OneWay
  System.Windows.Data Warning: 59 : BindingExpression (hash=37997052): Default update trigger resolved to PropertyChanged
  System.Windows.Data Warning: 60 : BindingExpression (hash=37997052): Attach to System.Windows.Controls.MenuItem.Command (hash=47163810)
  System.Windows.Data Warning: 64 : BindingExpression (hash=37997052): RelativeSource (FindAncestor) requires tree context
  System.Windows.Data Warning: 63 : BindingExpression (hash=37997052): Resolve source deferred
  System.Windows.Data Warning: 54 : Created BindingExpression (hash=18607377) for Binding (hash=17879784)
  System.Windows.Data Warning: 56 :   Path: 'PlacementTarget.Tag.SendInstantMessageCommand'
  System.Windows.Data Warning: 58 : BindingExpression (hash=18607377): Default mode resolved to OneWay
  System.Windows.Data Warning: 59 : BindingExpression (hash=18607377): Default update trigger resolved to PropertyChanged
  System.Windows.Data Warning: 60 : BindingExpression (hash=18607377): Attach to System.Windows.Controls.MenuItem.Command (hash=32025604)
  System.Windows.Data Warning: 64 : BindingExpression (hash=18607377): RelativeSource (FindAncestor) requires tree context
  System.Windows.Data Warning: 63 : BindingExpression (hash=18607377): Resolve source deferred
  System.Windows.Data Warning: 65 : BindingExpression (hash=37997052): Resolving source 
  System.Windows.Data Warning: 68 : BindingExpression (hash=37997052): Found data context element: &lt;null&gt; (OK)
  System.Windows.Data Warning: 71 :     Lookup ancestor of type ContextMenu:  queried ContextMenu (hash=46231978)
  System.Windows.Data Warning: 70 :   RelativeSource.FindAncestor found ContextMenu (hash=46231978)
  System.Windows.Data Warning: 76 : BindingExpression (hash=37997052): Activate with root item ContextMenu (hash=46231978)
  System.Windows.Data Warning: 106 : BindingExpression (hash=37997052):   At level 0 - for ContextMenu.PlacementTarget found accessor DependencyProperty(PlacementTarget)
  System.Windows.Data Warning: 102 : BindingExpression (hash=37997052): Replace item at level 0 with ContextMenu (hash=46231978), using accessor DependencyProperty(PlacementTarget)
  System.Windows.Data Warning: 99 : BindingExpression (hash=37997052): GetValue at level 0 from ContextMenu (hash=46231978) using DependencyProperty(PlacementTarget): &lt;null&gt;
  System.Windows.Data Warning: 104 : BindingExpression (hash=37997052):   Item at level 1 is null - no accessor
  System.Windows.Data Warning: 101 : BindingExpression (hash=37997052): Replace item at level 2 with {NullDataItem}
  System.Windows.Data Warning: 78 : BindingExpression (hash=37997052): TransferValue - got raw value {DependencyProperty.UnsetValue}
  System.Windows.Data Warning: 86 : BindingExpression (hash=37997052): TransferValue - using fallback/default value &lt;null&gt;
  System.Windows.Data Warning: 87 : BindingExpression (hash=37997052): TransferValue - using final value &lt;null&gt;
  System.Windows.Data Warning: 65 : BindingExpression (hash=18607377): Resolving source 
  System.Windows.Data Warning: 68 : BindingExpression (hash=18607377): Found data context element: &lt;null&gt; (OK)
  System.Windows.Data Warning: 71 :     Lookup ancestor of type ContextMenu:  queried ContextMenu (hash=64235)
  System.Windows.Data Warning: 70 :   RelativeSource.FindAncestor found ContextMenu (hash=64235)
  System.Windows.Data Warning: 76 : BindingExpression (hash=18607377): Activate with root item ContextMenu (hash=64235)
  System.Windows.Data Warning: 105 : BindingExpression (hash=18607377):   At level 0 using cached accessor for ContextMenu.PlacementTarget: DependencyProperty(PlacementTarget)
  System.Windows.Data Warning: 102 : BindingExpression (hash=18607377): Replace item at level 0 with ContextMenu (hash=64235), using accessor DependencyProperty(PlacementTarget)
  System.Windows.Data Warning: 99 : BindingExpression (hash=18607377): GetValue at level 0 from ContextMenu (hash=64235) using DependencyProperty(PlacementTarget): &lt;null&gt;
  System.Windows.Data Warning: 104 : BindingExpression (hash=18607377):   Item at level 1 is null - no accessor
  System.Windows.Data Warning: 101 : BindingExpression (hash=18607377): Replace item at level 2 with {NullDataItem}
  System.Windows.Data Warning: 78 : BindingExpression (hash=18607377): TransferValue - got raw value {DependencyProperty.UnsetValue}
  System.Windows.Data Warning: 86 : BindingExpression (hash=18607377): TransferValue - using fallback/default value &lt;null&gt;
  System.Windows.Data Warning: 87 : BindingExpression (hash=18607377): TransferValue - using final value &lt;null&gt;
  </code></pre>