private void Button_Click(object sender, RoutedEventArgs e)
{
// updating the single property in collection.
var items = (this.DataContext as ViewModel).PersonDetails;
items[0].Children[0].Id = 2000;
or
// to replace the collection
var collection = new ObservableCollection<PersonInfo>();
collection.Add(new PersonInfo() { Id = 1012, FirstName = "Smith", LastName = "Ve", Salary = 29022, MyEyeColor = "Brown", Cake = "Cream", DOB = DateTime.Today, LikesCake = true });
collection.Add(new PersonInfo() { Id = 1015, FirstName = "Willam", LastName = "Ku", Salary = 32990, MyEyeColor = "Brown", Cake = "Chocolate", DOB = DateTime.Today, LikesCake = false });
items[1].Children = collection;
} |
private void Button_Click(object sender, RoutedEventArgs e)
{
// updating the single property in collection.
var items = (this.DataContext as ViewModel).PersonDetails;
items[1].FirstName = "David";
} |