title: Binding the CheckBox IsChecked Property to SelectedItems Property of a ListView
body: <p>I struggle with MVVM data binding.</p>
  
  <p>In my Example I have a <code>ListView</code> filled with items which contains a <code>CheckBox</code> and some other content.</p>
  
  <pre><code>&lt;ListView 
     Background="#f0f0f0" 
     Grid.Row="1" 
     ItemsSource="{Binding ListViewCollection}" 
     SelectedItem="{Binding SelectedItem}" 
     IsSynchronizedWithCurrentItem="True" 
     BorderThickness="0" 
     Margin="5"&gt;
     &lt;ListView.View&gt;
        &lt;GridView&gt;
           &lt;GridView.Columns&gt;
              &lt;GridViewColumn&gt;
                 &lt;GridViewColumn.CellTemplate&gt;
                    &lt;DataTemplate&gt;
                       &lt;CheckBox  Tag="{Binding TheValue}" IsChecked="{Binding IsChecked}" /&gt;
                    &lt;/DataTemplate&gt;
                 &lt;/GridViewColumn.CellTemplate&gt;
              &lt;/GridViewColumn&gt;
              &lt;GridViewColumn DisplayMemberBinding="{Binding TheText}" Header="#Cell" /&gt;
              &lt;GridViewColumn DisplayMemberBinding="{Binding TheVoltage}" Header="U[V]" /&gt;
           &lt;/GridView.Columns&gt;
        &lt;/GridView&gt;
     &lt;/ListView.View&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>The <code>ItemSource</code> of the <code>ListView</code> is bound to a <code>ObservableCollection</code> of a data class in the ViewModel, as you do in MVVM. </p>
  
  <p>Now I wanted to hook up the <code>Checkbox.IsChecked</code> property of each list view item to the parents <code>ListView.SelectedItems</code> property to trigger it. Why? Because I want to show/hide a series of data graph. So if <code>CheckBox</code> in row one is checked, show graph 1. If <code>CheckBox</code> in row 2 is unchecked, hide graph 2 and so on. Something like this:</p>
  
  <pre><code>public ListViewItem SelectedItem
      {
          get { return mSelectedItem; }
          set
          {
              if (mSelectedItem!= value)
              {
                  mSelectedItem= value;
                  RaisePropertyChanged("SelectedItem");
                  if (SelectedItem.IsChecked == true)
                  {
                      OxyplotModel.Series[1].IsVisible = false;
                      OxyplotModel.InvalidatePlot(true);
                  }
              }
          }
      }
  </code></pre>
  
  <p>To trigger this property you have to click twice in the GUI. First check the <code>CheckBox</code> and then click again on the row to trigger and hide the graph. But I wanted to trigger <code>SelectedItems</code> property right after the <code>CheckBox</code> is clicked.</p>
  
  <p>By now I bound a command to the <code>CheckBox</code> and pass a parameter to distinguish the check boxes. But as I said, I want to use the property.</p>
  
  <p>Is this possible or do have better ideas to solve my problem?</p>