What is the syntax for setting focus to the first cell in a xamDataPresenter addnew row once a previous row has been added?
Thanks,
Greg Tingle
Hello Greg,
You have to do couple of things to achieve this.
1) Handle the RecordAdded event and store locally the currently added record:
DataRecord dr;
...
void xamDataGrid1_RecordAdded(...)
{
dr = e.Record;
}
2. Handle RecordUpdated event and check if the updated record is the currently added one. After this record is updated, you can start edit mode of the AddNewRecord UI like this:
void xamDataGrid1_RecordUpdated(...)
if (e.Record == dr)
xamDataGrid1.RecordManager.CurrentAddRecord.Cells[0].IsActive = true;
xamDataGrid1.ExecuteCommand(DataPresenterCommands.StartEditMode);
Hope this helps.
Thanks. Almost works. The row and cell gets set as the currently selected item but the cell doesn't enter edit mode even though StartEditMode is applied. This is for the 9.1 version of the WPF xamdatapresenter.
Yes, you are right. I did this with 9.2 where it worked as expected. I am not completely sure why this is not the same with 9.1. I will update this thread when I have more information on this.
Hi,
I pasted this code into a simple example and it is still not focusing the CurrentAddRow.Cell[0]. Specifically this code seems to have no effect......I'm using 9.2 in an XBAP
myGrid.RecordManager.CurrentAddRecord.Cells[0].IsActive =
true;
myGrid.ExecuteCommand(
DataPresenterCommands.StartEditMode);
Any thoughts?
has any one found a solution here? I'm having the same problem