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
910
Adding Rows to DataTable doesnt show in Grid.
posted

Hey All,

 Got a little bit of a problem here that has me totally confused. I have the datagrid, and a empty DataTable. 

I bind the DataTable to the DataGrid with -- datagrid.DataSource = dataTable.

After I setup this Binding, I kick off a BackGroundWorker to create new rows and add them to the DataTable.  Doing an AcceptChanges after creating rows.

However none of the new rows show up in my DataGrid.

Playing around, it seems like I have to do a UpdateLayout() on the DataGrid to get the rows to show up ?  Do I have to always do this ?  

Shouldnt the DataGrid detect that new rows have been added to the DataTable ?

Thanks in Advance !!

Allen 

  • 8576
    Offline posted
    Hi Allen -
     
    The XamDataGrid does not support the addition or removal of rows on another thread - it does support the modification of cell data on another thread but we could not safely do the same with add/remove.
     
    Joe