Can we display unbound data to the DataGrid..??

Nov 14, 2008 at 6:29 PM
Hi..,
Can we display unbound data to the DataGrid.?? say just by adding columns and rows..??
Coordinator
Nov 14, 2008 at 9:57 PM
Yes, you can add columns through DataGrid.Columns.Add() and you can add rows through DataGrid.Items.Add. 
Nov 15, 2008 at 2:52 AM
Hi vinsibal,
can you give us an example.
how to add / edit / select unbound data in datagrid??
Thanks in advance.
Nov 15, 2008 at 2:16 PM
Thanks Vinisibal, for you reply,

But i am not add column/rows as you have said, can you please give an example that shows how to achieve this..??
Coordinator
Nov 18, 2008 at 12:34 PM
Here is a basic example:

DataGrid_Standard.Columns.Add(

new DataGridTextColumn { Header = "First Name", Binding = new Binding("FirstName") });
DataGrid_Standard.Columns.Add(
new DataGridTextColumn { Header = "Last Name", Binding = new Binding("LastName") });
DataGrid_Standard.Items.Add(
new Person { FirstName = "John", LastName = "Smith" });
DataGrid_Standard.Items.Add(
new Person { FirstName = "John", LastName = "Smith" });
DataGrid_Standard.Items.Add(
new Person { FirstName = "John", LastName = "Smith" });
DataGrid_Standard.Items.Add(
new Person { FirstName = "John", LastName = "Smith" });

 

Nov 19, 2008 at 2:46 AM
Thanks Vinsibal,

I will try it out.