title: How to automatically set IsSelected on a GridViewItem?
body: <p>I have a list with objects that have all a property: IsSelected. Now I try to automatically select the items in a GridView if the property is true.</p>
  
  <p>I tried to override PrepareContainerForItemOverride in the GridView and set a binding to the objects with no success. Any ideas?</p>
  
  <pre><code>protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
  {
      base.PrepareContainerForItemOverride(element, item);
  
      var listItem = element as GridViewItem;
      var binding = new Binding 
      {
          Mode = BindingMode.TwoWay, 
          Source = item, 
          Path = new PropertyPath("Selected")
      };
      if (listItem != null) 
          listItem.SetBinding(SelectorItem.IsSelectedProperty, binding);
  }
  </code></pre>