我在鼠标双击时有一个列表视图我正在尝试获取所选项目的名称和路径,我编写了以下代码但我收到“System.NullReferenceException”错误
public class Listview_data
{
public string name
{
get;
set;
}
public ImageSource Image
{
get;
set;
}
public string path
{
get;
set;
}
};
private void ListView_MouseDClick(object sender, MouseButtonEventArgs e)
{
Listview_data lvd = null;
lvd = DocsListView.SelectedItem as Listview_data;
MessageBox.Show(lvd.name);
}
我附上了调试的截图