I have an grid where I set the cell click action to be RowSelect, but I want to enter EditMode when the user double-clicks the cell (We do a good bit of logic on BeforeExitEditMode that I want to avoid if possible.)
ultraGrid1.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect;
Then in the DoubleClickCell handler, I enter EditMode.
void ultraGrid1_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { if (e.Cell.IsInEditMode) return; ultraGrid1.ActiveCell = e.Cell; ultraGrid1.PerformAction(UltraGridAction.EnterEditMode); }
This seems to work fine in most cases, except when the DataTable column type is DateTime. Then it kicks you out of EditMode right after you enter.
It does work for the DateTime column if you set the column Style to Edit, though:
e.Layout.Bands[0].Columns[3].Style = ColumnStyle.Edit;
But it does not work if you don't set the Style, or set it to any of the Date variants.
I recently upgraded from v7.3 to v9.1 and the behavior is the same in both. I have attached a sample application which displays the behavior (uses v9.1)
Any ideas?
Thanks,Stefan
Works like a charm! Thanks!
Stefan
Stefan,
This seems to be a timing issue with the EditorWithMask and when the DoubleClick event is fired. Fortunately, you can work around this by simply delaying the PerformAction call through a BeginInvoke:
void ultraGrid1_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e){ if (e.Cell.IsInEditMode) return; ultraGrid1.ActiveCell = e.Cell; this.BeginInvoke(new MethodInvoker(this.EnterEditMode)); }private void EnterEditMode(){ ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);}
-Matt