WPF中用Datagrid怎么才能实现类似的功能
1个回答
展开全部
ContextMenu context = new ContextMenu();
public Window1()
{
InitializeComponent();
MenuItem item = new MenuItem();
item.Header = "快捷方式";
item.Click += new RoutedEventHandler(item_Click); context.Items.Add(item);
} void item_Click(object sender, RoutedEventArgs e)
{
throw new NotImplementedException();
} private void dataGrid1_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
context.IsOpen = true;
} 自己看吧,我玩WPF多年了
public Window1()
{
InitializeComponent();
MenuItem item = new MenuItem();
item.Header = "快捷方式";
item.Click += new RoutedEventHandler(item_Click); context.Items.Add(item);
} void item_Click(object sender, RoutedEventArgs e)
{
throw new NotImplementedException();
} private void dataGrid1_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
context.IsOpen = true;
} 自己看吧,我玩WPF多年了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询