1
如何从WinRT的ListView中获取所选项目(对象)?获取ListView的选定项目
如何从WinRT的ListView中获取所选项目(对象)?获取ListView的选定项目
使用SelectedItem
属性。您可以使用绑定:
<ListView x:Name="myListView" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" />
或者你也可以从后面的代码访问属性:
var item = myListView.SelectedItem;
如果SelectionMode
不是Single
使用SelectedItems
来代替。
你使用什么语言? –
for c#参见http://stackoverflow.com/questions/13031465/getting-selected-item-information-from-listview-in-winrt –
for xaml请参阅http://stackoverflow.com/questions/14551766/xaml-listview -change-image-source-for-selected-item –