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
原文地址:http://www.cnblogs.com/Events/p/3848584.html