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
920
Regarding Popup and XamPivotGrids
posted

Hi,

in my current application i have a button that shows a popup when clicked. this popup form contains an XamPivotGrid that takes its values from an xml.

Also in the popup there is a button that when clicked saves the information edited in the grid to the xml.

The first time i open the popup and click the button to save the values everything works fine and the popup closes. The second time i click to open the popup  get this message: Object reference not set to an instance of an object.

and below  is what is called when i open the popup:

ObservableCollection<MarketShares> mSharesData = SampleDataGenerator.GenerateMarketShares((DateTime)this.avgdatepicker1.Tag, (DateTime)this.avgdatepicker2.Tag, 2);

            SampleFlatDataSourceAverageVsBrand flatDataSource = new SampleFlatDataSourceAverageVsBrand();

            flatDataSource.Measures.CollectionChanged += Measures_CollectionChanged; 

            flatDataSource.ItemsSource = mSharesData;

            this.AvgPivotGrid.DataSource = flatDataSource;

         //   this.AvgPivotGrid.DataSource.Measures.CollectionChanged += new NotifyCollectionChangedEventHandler(Measures_CollectionChanged);

            this.AvgPivotGrid.CellControlAttached += new EventHandler<PivotCellControlAttachedEventArgs>(AvgPivotGrid_CellControlAttached);

 

            this.AvgPivotGrid.CellEdited += AvgPivotGrid_CellEdited;

            this.AvgPivotGrid.LayoutLoaded += AvgPivotGrid_LayoutLoaded;

 

Please advise,

Nazha

Parents
  • 8831
    posted

    Hello,

    Is there any additional information about where this exception occurs? Have you unsubscribed from the pivot grid events when the popup is closed?


    this.AvgPivotGrid.CellControlAttached -= new EventHandler<PivotCellControlAttachedEventArgs>(AvgPivotGrid_CellControlAttached);
    this.AvgPivotGrid.CellEdited -= AvgPivotGrid_CellEdited;
    this.AvgPivotGrid.LayoutLoaded -= AvgPivotGrid_LayoutLoaded;


    Plamen.

Reply Children
No Data