I have a XamDataGrid bound to an IBindingList, with the list being updated, grid cells are being updated but CellUpdated Event is not being fired.
I am attaching handler as below:
_grid.CellUpdated += new EventHandler<Infragistics.Windows.DataPresenter.Events.CellUpdatedEventArgs>(_grid_CellUpdated);
I also tried a different way of attaching handler just in case same damn intenal implementation has handled the event.
_grid.AddHandler(XamDataGrid.CellUpdatedEvent, new EventHandler<Infragistics.Windows.DataPresenter.Events.CellUpdatedEventArgs>(_grid_CellUpdated), true);
But this does not work either. Also I tried RecordChanged, RecordUpdated, CellChanged but none of them seems to be working.
Has somebody faced such an issue? Any help is appreciated.
Hi,
I'm currently using NetAdvantage for WPF 8.2 and have not experienced problems with mouse wheel scrolling or scrollbar clicking. Of course, my test app is very simple and only contains a single xamDataGrid instance.
If you can supply any other information such as the container the xamDataGrid control is hosted in, I might be able to get to the bottom of it.
Thanks
When testing this out, I find that under certain conditions the RecordPresenter is not null, and therefore triggers the animation. E.g.
- the scrollbar is clicked (even mouse down without moving)
- and on occasion when scrolling the mouse
Do you know the reason why this occurs?
Thanks.
Hi Samuel,
This solution a lot better. I will give it a try later on.
Could you add native support for this in CellValuePresenter as a RoutedEvent, so developers can easily hook up an animation without going through all the code behind? it'd be nice to have this in an upcoming hotfix.
Using the default RecordContainerGenerationMode (Recycle) for xamDataGrid causes the ValueEditor's ValueChanged event to fire whenever records are scrolled into view. If you handle the ValueChanged event and run your animation from the code behind, it is possible to determine if the ValueChanged event was fired due to a change in your data model or from records being scrolled into view (See code example and comments below).
However, cells outside the viewable region of xamDataGrid do not have any CellValuePresenters and/or Editors associated with them until they are scrolled into view. Therefore, the ValueEditor's ValueChanged event will not fire for any cell's that are outside the viewable region of xamDataGrid.
In XAML:
<Style TargetType="{x:Type igDP:CellValuePresenter}"> <EventSetter Event="igEditors:ValueEditor.ValueChanged" Handler="OnValueChanged" /></Style>
In C#:
private void OnValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e){ ValueEditor editor = (ValueEditor)e.OriginalSource;
CellValuePresenter cvp = (CellValuePresenter)editor.Host;
RecordPresenter presenter = DataRecordPresenter.FromRecord(cvp.Record);
//If the xamEditor's ValueChanged event is raised because a record is scrolled into view, the RecordPresenter will be null.
if (presenter != null) { //Since the RecordPresenter was found, this ValueChanged event was raised because a change was made to the underlying data model.
//Run your animation here }}
Hi again,
I realized after testing the solution that the virtualization of records causes the xamEditors to raise the ValueChanged event whenever a record is scrolled into view. At the moment, I'm still trying to find a solution that will work with virtualization. I'll post when I have some more information.