Reputation: 293
I have a ListView in the itemDetailPage and I would like to share the selected item via e-mail. For which, I need to get the selected item from that listview.
What I tried is
if(listview1.SelectedItems.Count==1)
{
var item = listview1.SelectedItem
}
But I dont get the name, I get only the place it is taken from. Any suggestions?
Upvotes: 2
Views: 993
Reputation: 15296
Try this. You need to cast SelectedItem
with your model class.
if (listview1.SelectedItems.Count==1)
{
var item = listview1.SelectedItems[0] as Node
}
Upvotes: 1
Reputation: 98750
Use Count
instead of count
. C# is case sensitive.
if(listview1.SelectedItems.Count == 1)
{
var item = listview1.SelectedItems[0].ToString();
}
Upvotes: 1