title: Getting selected item in Items control
body: <p>I know that there is no selected item property in Items Control
  So I am trying to do the things via command parameter:</p>
  
  <pre><code> &lt;ItemsControl ItemsSource="{Binding Vrapper.myVM.Names}" x:Name="NamesCtr"&gt;
                                  &lt;ItemsControl.ItemTemplate&gt;
                                      &lt;DataTemplate&gt;
                                          &lt;MenuItem Header="{Binding}"&gt;
                                              &lt;MenuItem.ItemContainerStyle&gt;
                                                  &lt;Style TargetType="{x:Type MenuItem}"&gt;
                                                      &lt;Setter Property="Command" Value="{Binding ElementName=NamesCtr, Path=DataContext.Vrapper.myVM.LoadCommand}"/&gt;
                                                      &lt;Setter Property="CommandParameter" Value="{Binding}" /&gt;
                                                  &lt;/Style&gt;
                                              &lt;/MenuItem.ItemContainerStyle&gt;
                                          &lt;/MenuItem&gt;
                                      &lt;/DataTemplate&gt;
                                  &lt;/ItemsControl.ItemTemplate&gt;
                              &lt;/ItemsControl&gt; 
  </code></pre>
  
  <p>And command is not working =( </p>
  
  <p>in myVM there is:  </p>
  
  <pre><code>...
  loadCommand = new VrapCommand(load);
  ...
  
  public void load(Object obj)
  {
      string chosenName = obj as string;
  }
  </code></pre>
  
  <p>if I will try the following DataTemplate:</p>
  
  <pre><code>&lt;DataTemplate&gt;
      &lt;MenuItem Header="{Binding}" Command="{Binding ElementName=NamesCtr,   Path=Path=DataContext.Vrapper.myVM.LoadCommand}"/&gt;
  &lt;/DataTemplate&gt;
  </code></pre>
  
  <p>the load function is hit (the command is working) ,  but I need to pass this param (name of selected menu item) to function.</p>