How to get selected ListView Item?

c#, wpf

Solution

I guess you should use SelectedItem not SelectedItems:

This property is meant to be used when SelectionMode does not equal Single. If the selection mode is Single the correct property to use is SelectedItem.

Problem

Possible Duplicate: WPF Listview Access to SelectedItem and subitems I have a listview in my xaml and I want to get the selected item in the code-behind. In fact I would like to get the content of the item (which is an object). I've tried to do MyListView.SelectedItems[0] but it doesn't work, I have "accessor get or set expected".

Original source

Related problems