title: What is up with capturing Xamarin CollectionView Selections only sending null objects?
body: <p>I have been using every example on the internet to make my CollectionView send the object to my ViewModel, with no luck!  This is being tested as an Android project, by the way.</p>
  <p>One weird thing to note: instead of the selected cells turning orange (like the MS sample solutions),
  my CollectionView items just flash grey, real quick.  I haven't applied any formatting, so I don't know why that would be any different than the default.</p>
  <p>I tried to be thorough but brief, to understand what's not working.  I have used the term &quot;My&quot; to represent my custom class which I believe you have to cast CollectionView's output into.</p>
  <p>My Xaml...</p>
  <pre><code>&lt;CollectionView                 
    x:Name=&quot;MyCollectionView&quot;
    SelectionMode=&quot;Multiple&quot;  //Why don't my cells remain highlighted?
    ItemsSource=&quot;{Binding MyItemSource}&quot;
    SelectedItem=&quot;{Binding SelectedItem, Mode=TwoWay}&quot;    //This doesn't seem to do anything
    SelectedItems=&quot;{Binding SelectedItems, Mode=TwoWay}&quot;  //This doesn't seem to do anything
    SelectionChangedCommand=&quot;{Binding SelectionChangedCommand}&quot;&gt;  //This gets called on tapping
      &lt;CollectionView.ItemTemplate&gt; &lt;!--Contains a Grid with labels and an icon--&gt;
  </code></pre>
  <p>My View Model...</p>
  <pre><code>  private ObservableCollection&lt;MyClass&gt; _myItemSource;
    public ObservableCollection&lt;MyClass&gt; MyItemSource {get... set... data from database}
     
    //Isn't this the selected items?  I think I have to cast this list's objects to my class.
    public IList&lt;object&gt; ItemsSelected { get; set; }  
  
    //To cast objects returned from CollectionView into my class:
    public ObservableCollection&lt;MyClass&gt; MyItemsSelected { get; set; }  
  
  
    //Shouldn't SelectedItem be the most recently tapped item?  
    private MyClass _selectedItem;  
    public MyClass SelectedItem 
    
    {
      get
      {
          return _selectedItem;
          //Should this be : return (MyClass)_selectedItem?
      }
      set
      {
          _selectedItem = value;              
          OnPropertyChanged();
      }
    }
  
  //No problem calling this, but it's arg is always null:
    public ICommand SelectionChangedCommand { get; set; }
  
  //My Constructor...
    ItemsSelected = new List&lt;object&gt;();
    MyItemsSelected = new ObservableCollection&lt;MyClass&gt;();
    SelectionChangedCommand = new Command&lt;object&gt;(OnSelectionChangedCommand); //object is always null!
  
  //My One Method... gets called dependably, but obj is always null!
      private void OnSelectionChangedCommand(object obj) 
      {
          //if (obj != null)
          {
              var x = (MyClass)obj;
  
              if (MyItemsSelected .Contains(x))
              {
                  MyItemsSelected .Remove(x);
              }
              else
              {
                  MyItemsSelected .Add(x);
              }
          }
          Debug.WriteLine(&quot;~~~ OnSelectionChangedCommand Called&quot;);
      }
  </code></pre>
  <p>I think I'm following a really basic MVVM pattern, but any functioning example doesn't seem to fit my project... I just want to grab the item selected... I'd prefer multiple selections that remain highlighted until re-tapped (like the MS Docs example), but I'm not picky.  I'd really like to understand what is going on, here.  Thanks!</p>