tags:

views:

461

answers:

1

I'm using the toolkit:DataGrid from CodePlex.

I'm generating the columns in code.

How can I set the equivalent of {Binding FirstName} in code?

Or alternatively, how can I just set the value, that's all I need to do, not necessarily bind it. I just want the value from my model property in the cell in the datagrid.

DataGridTextColumn dgtc = new DataGridTextColumn();
dgtc.Header = smartFormField.Label;
dgtc.Binding = BindingBase.Path = "FirstName"; //PSEUDO-CODE
dgtc.CellValue= "Jim"; //PSEUDO-CODE
CodePlexDataGrid.Columns.Add(dgtc);
+2  A: 

Untested, but the following should work:

dgtc.Binding = new Binding("FirstName");
samjudson