We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

data binding with Dynamically Generated SdDataGrid

Hallo there!
I have some question about SfDataGrid:
I need dynamically create the table with N columns
After SfDataGrid creation i created columns:

            foreach (var v in _list)
            {
                sfDataGrid2.Columns.Add(new GridTextColumn() {HeaderText = v.chName});
            }
           sfDataGrid2.ItemsSource = model1.Collection2;

After that actions i can see my new columns , but i cant understand how to fill the table?
How to  add new row with N-parameters?
Can i bind my datasourse with dinamically creadted sfDataGrid?

4 Replies

DM Dmytro replied to Dmytro March 28, 2016 07:10 AM UTC

Hallo there!
I have some question about SfDataGrid:
I need dynamically create the table with N columns
After SfDataGrid creation i created columns:

            foreach (var v in _list)
            {
                sfDataGrid2.Columns.Add(new GridTextColumn() {HeaderText = v.chName});
            }
           sfDataGrid2.ItemsSource = model1.Collection2;

After that actions i can see my new columns , but i cant understand how to fill the table?
How to  add new row with N-parameters?
Can i bind my datasourse with dinamically creadted sfDataGrid?

Sorry for inaccuracy. I want to add a new line with the changes in my collection


SV Srinivasan Vasu Syncfusion Team March 28, 2016 11:12 AM UTC

Hi Dmytro,

Thanks for contacting Syncfusion support.

We have analyzed your query and we have prepared the sample as per your requirement by create DataTable dynamically in SfDataGrid. You can download the sample from the below location.

Sample: http://www.syncfusion.com/downloads/support/forum/123525/ze/Dynamic_DataTable2020643212

Please refer the below UG link to know more about DataBinding in SfDataGrid,

Link: http://help.syncfusion.com/wpf/sfdatagrid/data-binding

Please let us know if you require further assistance on this.

Regards,
Srinivasan




DM Dmytro April 4, 2016 08:31 AM UTC

Thanks for your reply. it is complete answer of my question. but I would like to clarify one moment:
SfDataGrid  is replacement of DataGrid or "wrapper" of this class?



JG Jai Ganesh S Syncfusion Team April 5, 2016 02:21 PM UTC

Hi Dmytro,


The SfDataGrid is a replacement of DataGrid and its not a wrapper of DataGrid. SDataGrid has all the features as like as MSDataGrid and also have some additional features, better performance, and user friendly.


UG Link: http://help.syncfusion.com/wpf/sfdatagrid/overview


Regards,

Jai Ganesh S



Loader.
Up arrow icon