wpf中datagrid的双击事件

 
  ContextMenu context = new ContextMenu();
        public WStorageTankList()
        {
            InitializeComponent();

            MenuItem item = new MenuItem();
            item.Header = "详细";
            item.Click += new RoutedEventHandler(item_Click);

            context.Items.Add(item);
        }

  void item_Click(object sender, RoutedEventArgs e)
        {
            WStorageTankDetailScreen wStorageTankDetailScreen = new WStorageTankDetailScreen();
            wStorageTankDetailScreen.Show();
        }

   private void dgStorageTankInfo_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            context.IsOpen = true;
        }


你可能感兴趣的:(datagrid,object,WPF)