title: How to bind a ListView with SelectionMode multiple to achieve MVVM using Behaviors SDK in Windows 8.1
body: <p>I have a Windows 8.1 application with a ListView with SelectionMode multiple(making the ListView allow the user to select multiple entries)</p>
  
  <p>I am trying to use <a href="http://msdn.microsoft.com/en-us/library/dn457340.aspx" rel="nofollow">Behaviors SDK</a> from Microsoft</p>
  
  <pre><code>&lt;DataTemplate x:Key="DataItemTemplate"&gt;
      &lt;TextBlock Text="{Binding Name}" Margin="10,0,0,0"/&gt;
  &lt;/DataTemplate&gt;
  
  &lt;ListView ItemsSource="{Binding Data}"
            SelectionMode="Multiple"
            ItemTemplate="{StaticResource DataItemTemplate}"&gt;
      &lt;Interactivity:Interaction.Behaviors&gt;
          &lt;Core:EventTriggerBehavior SourceObject="{Binding}" EventName="SelectionChanged"/&gt;
      &lt;/Interactivity:Interaction.Behaviors&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>As you can see the ItemSource of the ListView has been bound to the property Data which is a List in my ViewModel as shown below</p>
  
  <pre><code>public List&lt;MyData&gt; Data { get; set; }
  
  class MyData
  {
      public string Name { get; set; }
  
      public bool IsSelected { get; set; }
  }
  </code></pre>
  
  <p>The approach that I could think of was to set the IsSelected property to true in the class MyData if the corresponding element has been selected in my View. But that solution looks like I need to have codebehind.</p>
  
  <p>I have attached the EventTriggerBehavior for my ListView but I am unable to figure out how to Bind it and what to bind it to.</p>
  
  <p>I would be very glad if someone can point me in the right direction to achieve this so that my List Data will have the data for me to differentiate between my SelectedItems and non-selected items. Or better still if I can completely eliminate the IsSelected bool property it would be great.</p>
  
  <p>Thanks in Advance.</p>