user2545071
user2545071

Reputation: 1410

Can not add same column object into Xceed DataGrid

Good day!

I try to add the same column object into datagrid,but catch exception (with xaml).

 Column c = new Column();
 c.FieldName = "Text";
 c.Title = "Title";
 dgTable1.Columns.Add(c);
 dgTable2.Columns.Add(c); --exception.

Am i right, that i cannot do that- because i put reference of object "c" into method Add and when put it at another table-it throw exception?

So, to fix - need i to create c1 object and add this with Add method?

Thank you!

Upvotes: 0

Views: 137

Answers (1)

Dhaval Patel
Dhaval Patel

Reputation: 7601

you can use the below mentioned code.

for(int i=0;i<=2;i++)
{
    Column c = new Column();
    c.FieldName = "Text";
    c.Title = "Title";
    dgTable1.Columns.Add(c);
 }

Upvotes: 1

Related Questions