Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Cannot get value for first column on a selected row in listview

$
0
0

I'm trying to get the value of a the first column on a selected row that the user double clicks on in a listview found in my WPF application. Unfortunately, I keep getting the following error message:

Additional information: Unable to cast object of type 'PlotList' to type 'System.Windows.Controls.ListViewItem'.

Any idea how I can fix this? This is my code so far:

    private void PlotListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        var lvi = (ListViewItem)PlotListView.SelectedItems[0];
        MessageBox.Show(lvi.ToString());
    }

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>