Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
On the XamDataGrid (v2010.1), the ActiveDataItem is not yet set to the current data item when the event RecordActivated is raised (ActiveDataItem contains the previous data item). And yet in the RecordActivatedEventArgs of the RecordActivated event, the Record property is well set to the current item. Is that a bug, or a misunderstanding?
Thank for your answers.
Hello,
I am glad I managed to help you.
In case you would like to request a change in the grid’s default behavior, I can log a Feature Request for you.
I will be looking forward to hearing from you.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
Thanks a lot!
This workaround solves my problem.
Did you think that will be change in a more recent version?
Hello tscalco,
Thank you for your post.
I have been looking into your post and I do understand your concerns. I manage to reproduce the ActiveDataItem’s property behavior, but the Record collection is being updated earlier as expected. ActiveDataItem’s reaction is normal - it just needs a bit more time to update itself, and in order to ensure that this time will be given, I have used a dispatcher. Now I am able to retrieve the new DataItem in the RecordActivated event handler’s body.
This is the my code:
private void xamDataGrid1_RecordActivated(object sender, Infragistics.Windows.DataPresenter.Events.RecordActivatedEventArgs e)
{
var rec1 = (sender as XamDataGrid).ActiveRecord; // being updated as expected
var rec2 = e.Record; // being updated as expected as well
Dispatcher.BeginInvoke(new Action(() =>
var actDataItem = xamDataGrid1.ActiveDataItem; //when placed in a dispatcher this one will update now and the
new value will be retrieved in the handlers body
}), DispatcherPriority.Background, null);
}
Please if you have any further questions regarding the discussed matter, do not hesitate to ask us.