WPF下的ListView怎样添加Item的双击事件?
展开全部
<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());
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询