【发布时间】:2014-12-12 00:23:28
【问题描述】:
我正在尝试获取用户在我的 WPF 应用程序中找到的列表视图中双击的选定行上第一列的值。不幸的是,我不断收到以下错误消息:
Additional information: Unable to cast object of type 'PlotList' to type 'System.Windows.Controls.ListViewItem'.
知道如何解决这个问题吗?到目前为止,这是我的代码:
private void PlotListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var lvi = (ListViewItem)PlotListView.SelectedItems[0];
MessageBox.Show(lvi.ToString());
}
【问题讨论】:
-
PlotListView绑定了什么类型的数据?
-
@Sam 错误状态
PlotList