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
990
pivotgrid datasource
posted

Dears,

When i write this code:

 ObservableCollection<MarketShares> mSharesData = SampleDataGenerator.GenerateMarketShares((DateTime)this.datepicker1.Tag, (DateTime)this.datepicker2.Tag, 1);
  this.pivotGrid.DataSource = new SampleFlatDataSourceDateVsBrand();
 ((FlatDataSource)this.pivotGrid.DataSource).ItemsSource = mSharesData;
this.pivotGrid.DataSource.ResultChanged += DataSource_ResultChanged;
  this.pivotGrid.CellControlAttached += new EventHandler<Infragistics.Controls.Grids.PivotCellControlAttachedEventArgs>(pivotGrid_CellControlAttached);
    in the MainPage() the grid is is loaded correctly

 

but when writing this:

 public MainPage()
        {
            InitializeComponent();

  LoadXMLFile();

}

  private void LoadXMLFile()
        {
            WebClient xmlClient = new WebClient();
            xmlClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(XMLFileLoaded);
            xmlClient.DownloadStringAsync(new Uri("exportmsharesdata.xml", UriKind.RelativeOrAbsolute));
        }

        public void XMLFileLoaded(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string xmlData = e.Result;
                //  HtmlPage.Window.Alert(xmlData);
                XDocument Xdocument = XDocument.Parse(e.Result);
                using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    IsolatedStorageFileStream isoStreamsave = new IsolatedStorageFileStream("exportmsharesdata.xml", FileMode.Create, isoStore);
                 // MessageBox.Show("before save");
                    Xdocument.Save(isoStreamsave);
                    isoStreamsave.Close();
ObservableCollection<MarketShares> mSharesData = SampleDataGenerator.GenerateMarketShares((DateTime)this.datepicker1.Tag, (DateTime)this.datepicker2.Tag, 1);
  this.pivotGrid.DataSource = new SampleFlatDataSourceDateVsBrand();
 ((FlatDataSource)this.pivotGrid.DataSource).ItemsSource = mSharesData;
this.pivotGrid.DataSource.ResultChanged += DataSource_ResultChanged;
  this.pivotGrid.CellControlAttached += new EventHandler<Infragistics.Controls.Grids.PivotCellControlAttachedEventArgs>(pivotGrid_CellControlAttached);

                }
            }
        }

 

 

here the grid is displayed but without data, although, while debugging i can c that the flatdatasource  and itemsource are filled.

 

advice plz

 

Thanks,

Parents
  • 8831
    posted

    Hello,

    Could you try to set them in this order:

    SampleFlatDataSourceDateVsBrand flatDataSource = new SampleFlatDataSourceDateVsBrand();
    flatDataSource.ItemsSource = mSharesData;
    this.pivotGrid.DataSource = flatDataSource;

    PPilev.

Reply Children