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,
Hello,
Could you try to set them in this order:SampleFlatDataSourceDateVsBrand flatDataSource = new SampleFlatDataSourceDateVsBrand();flatDataSource.ItemsSource = mSharesData;this.pivotGrid.DataSource = flatDataSource;PPilev.
Hi Plamen,
I tried to do what you have mentioned and it worked but now it is not entering the Measures_CollectionChanged function to make the pivot grid cells editable. How can i fix that?
this is how i am calling it:
SampleFlatDataSourceDateVsBrand flatDataSource = new SampleFlatDataSourceDateVsBrand ();
flatDataSource.ItemsSource = mSharesData;
this.AvgPivotGrid.DataSource = flatDataSource;
this.AvgPivotGrid.DataSource.Measures.CollectionChanged += Measures_CollectionChanged;
this.AvgPivotGrid.CellControlAttached += new EventHandler<PivotCellControlAttachedEventArgs>(AvgPivotGrid_CellControlAttached);
this.AvgPivotGrid.CellEdited += AvgPivotGrid_CellEdited;
this.AvgPivotGrid.LayoutLoaded += AvgPivotGrid_LayoutLoaded;
Nazha