xaml:
1 <!-- TreeViewItem --> 2 <Style x:Key="{x:Type TreeViewItem}" TargetType="{x:Type TreeViewItem}"> 3 <EventSetter Event="MouseDoubleClick" Handler="MenuItem_Click" />
cs:需要做判断,防止响应两次
1 private void MenuItem_Click(object sender, RoutedEventArgs e) 2 { 3 TreeViewItem tviSender = sender as TreeViewItem; 4 if (tviSender.IsSelected) 5 MessageBox.Show("treeview被双击了"); 6 }