The reason you're getting an exception is because the SelectionChange event also fires when an item is deselected
. A deselection of the first item occurs when you tap the 2nd item.
So your code: object cc = e.NewItems
, will cause an exception because there is nothing in NewItems when the first item is deselelected before the second item becomes selected.
The proper way to handle this would be to either check e.NewItems for items before requesting an item at an index. As an example, this will work for your needs:
private void M4ReportDrawer_SelectionChanged(object sender, NotifyCollectionChangedEventArgs e)
if (e.NewItems != null && e.NewItems.Count > 0)
object cc = e.NewItems;
string reportName = (cc as M4DrawerItem).ReportName;
this.DisplayAlert("Selected item:", reportName, "OK");
>("M4ReportDrawer")).IsOpen = false;
Note: You can also catch items that were deselected by inspecting e.OldItems in the event handler.
Please let us know if you have any further trouble.
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items