private void dataGrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { ContextMenu context = new ContextMenu(); MenuItem item = new MenuItem(); item.Header = "点击删除该行数据"; item.Click += new RoutedEventHandler(item_Click); context.Items.Add(item); context.IsOpen = true; } void item_Click(object sender, RoutedEventArgs e) { // do something }
[WPF]DataGrid C#添加右键弹出选择菜单,布布扣,bubuko.com
时间: 2024-11-04 17:32:04