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
304
Binding different datasources to the same XamGrid
posted

 

I have a XamGrid and a combobox on my xaml page. Based on what value I select in the combobox, WCF returns the data and I set it as the ItemSource of the XamGrid. I am using DataTable to bind the data to the grid.

 public partial class Report: Page
   
{
       
private DataTable resultData;
       
.
       
.    

       
void proxy_GetDataCompleted(object sender, EventArgs e)
       
{                
             resultData
= new DataTable(e.Result);                
             webGridView
.ItemSource = resultData;                
       
}        

Now everytime I change the selection on the combobox, I do get different datasource from the WCF service (dataset has different columns) and even the data is bound correctly on the UI. For the first time the data is bound, I do see a valid count in webGridView.Columns, however for subsequent databindings, the data seems nicely bound on the grid/UI but the count on webGridView.Columns is 0 and I cannot access each of the columns. Even if I call invalidateData() before binding the new data source, it doesnt work. I apply formatting to the data programaticallly. Now since I cant access the columns when the itemsource has changed, the formatting rules arent applied. How do I fix it?