im having issues setting focus to the "add new row" via codebehind. I can get the row selected...i can even get the first cell of the row selected but i cant seem to trigger edit mode or get the cell to be focused and in edit mode.
how can i do this? im totally at a loss....
actually, that doesnt work. turns out its a defect w/ the timing in the grid. infragistics already sent a fix to us for it.
here is the workaround (from support):
bool _initialTemplateAddRecord = true;
bool _enterEditMode = false;
void XamDataGrid1_InitializeTemplateAddRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeTemplateAddRecordEventArgs e)
{
// Set the active cell
this.XamDataGrid1.ActiveCell = e.TemplateAddRecord.Cells[0];
// Don't enter edit mode when the grid is first initialized
if (!_initialTemplateAddRecord)
// set flag to start edit mode in the RecordsInViewChanged event
_enterEditMode = true;
}
_initialTemplateAddRecord = false;
void XamDataGrid1_RecordsInViewChanged(object sender, Infragistics.Windows.DataPresenter.Events.RecordsInViewChangedEventArgs e)
// Start edit mode if the flag is set
if (_enterEditMode)
this.XamDataGrid1.ExecuteCommand(DataPresenterCommands.StartEditMode);
// reset the flag to false
_enterEditMode = false;
DataRecord templateAddRecord = grid.RecordManager.CurrentAddRecord;
grid.RecordManager.CurrentAddRecord.Cells[0].IsActive = true; grid.ExecuteCommand(DataPresenterCommands.StartEditMode);