WPF下的ListView怎样添加Item的双击事件?
1个回答
展开全部
<Grid>
<ListView x:Name="lvw"
MouseDoubleClick="ListView_MouseDoubleClick">
<ListView.Items>
<ListViewItem>item1</ListViewItem>
<ListViewItem>item2</ListViewItem>
</ListView.Items>
</ListView>
</Grid>
private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
object o = lvw.SelectedItem;
if (o == null)
return;
ListViewItem item = o as ListViewItem;
MessageBox.Show(item.Content.ToString());
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询