I am trying to implement the patern shown in the "Live Data" sample for XamPivotGrid.The sample does not show how to re-wire the DataSource.ResultChanged event after it has completed.When I try to rewire the event the grid crashes. Please see the attached demo project.
void DataSource_ResultChanged(object sender, AsyncCompletedEventArgs e) { PeopleGrid.DataSource.ResultChanged -= DataSource_ResultChanged; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler((a, b) => this.Dispatcher.Invoke(new Action(() => FilterData()))); // Attempting to re-wire the ResultChanged event causes a crash: worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler((c, d) => PeopleGrid.DataSource.ResultChanged += new EventHandler<AsyncCompletedEventArgs>(DataSource_ResultChanged)); worker.RunWorkerAsync(); }
Thank you,Sam
As I was posting this request I noticed this post: http://community.infragistics.com/forums/t/69409.aspxI downloaded the code and ran it (changing the references to version 11.2) but I get null referenceexceptions. Perhaps there is a bug in 11.2?
Hi Sam,
Could you try the latest 11.2 SR? We have run your sample against it with no crashes. Also looking at your code I have noticed that written in this way DataSource_ResultChanged method will enter in endless "change-resut change" loop.
Plamen
Thank you Plamen, on this project I can not change the service release. I will try another approach.
Look at the modified version of MainWindow.xaml.cs I have attached. I have used CollectionViewSource over the items collection you have and then CollectionViewSource.View is passed to FlatDataSource.ItemsSource. FilterData() method is modified and after the initial call it is called again only when you have changed the values in the two combo drop down controls. ExpandDimensions() is little bit modified too, so you can see those two dimensions expanded when the grid is loaded for the first time.
Regards.Plmen.