I need to apply logic to a grid after the data has been bound. The FieldLayoutInitialized works for the first load, then i can use Sorted, Grouped and RecordFilterChanged to respond to changes. What i can't seem to find is an event that fires after i refresh the bound datasource.
I tried: DataValueChanged, DataContextChanged and SourceUpdated. I now plan to use my own event, but I need to make sure it fires after the refreshed data has been initialized in the grid.
Okay, there was a suggestion in this thread regarding raising the propertychanged event, which seems to give me the desired result, although this fires more times than required for the reason I need it. Are there any other more efficient methods than this?
This helped me partially. However, I'm firing this event in the way described in order to catch filter changes. Unfortunately, when the filter on my grid is regenerated as a result of the previous saving of customizations to the grid, the attempt to get the filtered in records using GetFilteredInDataRecords in CollectionChanged only fetches the entire set, and not the filtered set. Is there any way to intercept the filtered in records when customizations are applied?
all good. thanks!
HI,
I am just following up on this forum thread. Please let me know if you need further assistance.
Sincerely Matt Developer Support Engineer
Thanks. I was able to wire up the datacontextchanged to get the recordmanager.current and the collectionchanged event seems to do the trick.
private void GridDataContextChanged(object sender, DependencyPropertyChangedEventArgs e){ grdResults.RecordManager.Current.CollectionChanged += (sender1, e1) => Dispatcher.Invoke(DispatcherPriority.Normal, new MethodInvoker(HideRepeatSystems));}
Then, to get the visible records, i use a simple query that seems performant:
var dataRecords = (from x in grdResults.RecordManager.DataPresenter.Records where x.VisibleIndex >= 0 && x.VisibilityResolved == Visibility.Visible && x is DataRecord && !((x as DataRecord).IsFilteredOut ?? false) select x as DataRecord).OrderBy(t => t.VisibleIndex).ToList();