コード例 #1
0
ファイル: DSGiaoVien.xaml.cs プロジェクト: BUICANH79/baitap1
 private void grGiaoVien_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (sender != null)
     {
         DataGridRow row = sender as DataGridRow;
         if (row != null)
         {
             var item = row.DataContext as GiaoVien;
             if (item != null)
             {
                 var giaoVienInfo = new GiaoVienInfo(item);
                 giaoVienInfo.ShowDialog();
             }
         }
     }
 }
コード例 #2
0
ファイル: DSGiaoVien.xaml.cs プロジェクト: BUICANH79/baitap1
        private void grGiaoVien_ShowInfo(object sender, RoutedEventArgs e)
        {
            var menuItem = (MenuItem)sender;

            var contextMenu = (ContextMenu)menuItem.Parent;

            var item = (DataGrid)contextMenu.PlacementTarget;
            var b    = item.SelectedValue;

            if (b is GiaoVien)
            {
                var c            = b as GiaoVien;
                var giaoVienInfo = new GiaoVienInfo(c);
                giaoVienInfo.ShowDialog();
            }
        }