title: WPF ListBox send SelectedItem value to the viewmodel
body: <p>Inside MainWindow there is listbox filled with some data. These data is loaded from viewmodel, so I dont have any codebehind. </p>
  
  <p><strong>MainWindow.xaml</strong> </p>
  
  <pre><code>&lt;ListBox Name="listBoxData" 
           DataContext="{Binding Source={StaticResource MainWindowViewModelDataSource}}" 
           ItemTemplate="{DynamicResource BookTemplate}"                              
           ItemsSource="{Binding Books}" /&gt;
  </code></pre>
  
  <p>How can I know which book is selected inside listbox (using <code>ICommand</code>) and send it's property (<code>int Id</code> for example) to <code>viewmodel</code> for further processing?</p>