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
3160
Rewiring ResultChanged event causes crash
posted

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.aspx
I downloaded the code and ran it (changing the references to version 11.2) but I get null reference
exceptions.  Perhaps there is a bug in 11.2?

PivotGridTest.zip