Search code examples
silverlighteventspivotviewer

PivotViewer FilterChanged event


I am working on a reporting app using PivotViewer. There are two controls on my grid. One is PivotViewer and the other one is a reporting Panel. After a user changes the filter of the PIvotViewer, I will generate the report on the report Panel in real time based on the remaining items in the current collection of the PivotViewer (InScopeItems). FilterChanged seems like the perfect event to hook up. However, it seems FilterChanged event is fired BEFORE the filter change.The InScopeItems don't change in the call back.

What I want is an event AFTER the filter change.

Right now the reports are very funny because it's showing the last report before I change the filter.

What's the recommended event? This seems like a very common user case but I couldn't find any solution. Thanks!


Solution

  • The best way to track changes to InScopeItems is to track the property itself. If you case is to a INotifyCollectionChanged object, you will have access to a CollectionChanged event. This should get you where you need to go.

    Here is an example:

                (pViewer.InScopeItems as INotifyCollectionChanged).CollectionChanged += new NotifyCollectionChangedEventHandler(MainPage_CollectionChanged);