Answer»
- DataGrid shows the properties in the form of COLUMNS and each COLUMN STORE some value.
- DataGrid need two columns and each of them is bound to have one property each and that is ALSO different from one another.
- After creating the two columns with the properties the BINDING should be done of those columns to display the data.
The ways are being shown as:
DataGridTextColumn col1 = new DataGridTextColumn(); col1.Binding = new Binding("name"); DataGridTextColumn col2 = new DataGridTextColumn(); col2.Binding = new Binding("age"); dataGrid1.Columns.Add(col1); dataGrid1.Columns.Add(col2); The ways are being shown as: DataGridTextColumn col1 = new DataGridTextColumn(); col1.Binding = new Binding("name"); DataGridTextColumn col2 = new DataGridTextColumn(); col2.Binding = new Binding("age"); dataGrid1.Columns.Add(col1); dataGrid1.Columns.Add(col2);
|