Reputation: 14694
how can I get the selected item (the object) from a ListView in WinRT?
Upvotes: 1
Views: 4625
Reputation: 17865
Use the SelectedItem
property. You can use binding:
<ListView x:Name="myListView" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" />
Or you can access the property from code behind:
var item = myListView.SelectedItem;
If your SelectionMode
isn't Single
use SelectedItems
instead.
Upvotes: 1