Trying to access the property{Name} inside a list , using slectedItem ex.
var SName = e.SelectedItem;
if (e.SelectedItem == null)
{
return;
}
await DisplayAlert("Item Selected", SName.ToString(), "Ok");
the common way will be just var SName = e.SelectedItem.Name;. However I dont get the option to access it . I already have the get;set; and if I add a breakpoint on the mention line it shows me the Name property and value that I want to display. any suggestion ? Thanks
e.SelectedItem
is of type object
- you need to cast it to the appropriate type first
var item = (MyType) e.SelectedItem;
var name = item.Name;