I have a values in DataGrid like Name,Age,Address. I have to get datagrid values into Observable collection Object?Is it possible. .If Yes then plz anyone can tell me the solution?
Asked
Active
Viewed 1,008 times
-1
-
I Mean that i created a List
object =new List();(Customer is my classname) and I append those values into DataGrid like CustomerDataGrid.ItemsSource=object;(CustomerDataGrid is DataGrid name) and I want to copy data from CustomerDataGrid into ObservableCollection object..Can any1 tell me?in silverlight – Balaji Nikam Apr 25 '12 at 10:35
1 Answers
0
(sorry for my bad english)
Why you simply dont create a ObservableCollection in the first place instead of using a List?
Anyway, you can create an ObservableCollection with the List data this way:
ObservableCollection<Customer> customers = new ObservableCollection<Customer>(YOUR_LIST);
If you really need to get the data from the DataGrid ItemsSource:
ObservableCollection<Customer> customers = new ObservableCollection<Customer>(grid.ItemsSource as List<Customer>);

Leo
- 7,379
- 6
- 28
- 44