Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
RecordActivated & ActiveDataItem
posted

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.

Parents
  • 4475
    posted

    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.

     

    Sincerely,

    Ekaterina

    Developer Support Engineer

    Infragistics, Inc.

    www.infragistics.com/support

Reply Children