/// <summary> /// Edit mode by Single click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DG_GotFocus(object sender, RoutedEventArgs e) { Point newPoint = new Point(DG.Items.IndexOf(DG.CurrentItem), DG.CurrentColumn.DisplayIndex); if (e.OriginalSource.GetType() == typeof(DataGridCell)) { if (!newPoint.Equals(_SelectedCell)) { if (_CanEdit) { DG.BeginEdit(e); } else { _CanEdit = true; } _SelectedCell = newPoint; } } }
private void DG_CellEnter(object sender, DataGridViewCellEventArgs e) { DG.BeginEdit(false); if (e.ColumnIndex == 2)// the combobox column index { if (this.DG.EditingControl != null && this.DG.EditingControl is ComboBox) { ComboBox cmb = this.DG.EditingControl as ComboBox; cmb.DroppedDown = true; } } }