I am converting dataset to a Dynamic collection and binding it, this is working fine.Now when i need to add a new object which is empty to the collection . what i am trying is getting the ItemsSource of the datagrid and getting the first object inside the list. But it has some values inside it. How can i remove the values and bind a empty object using reflection.
Here is my code,
IEnumerable<object> collection = this.RetrieveGrid.ItemsSource.Cast<object>();
List<object> list = collection.ToList();
//i need to clear the values inside list[0]
object name = list[0];
//here i build the properties of the object, now i need to create an empty object using these properties and add it to the list
PropertyInfo[] pis = list[0].GetType().GetProperties();