Silverlight 3 - How to "refresh" a DataGrid content?
- by Josimari Martarelli
I have the following scenery: 
1    using System;
2    using System.Windows;
3    using System.Windows.Controls;
4    using System.Windows.Documents;
5    using System.Windows.Ink;
6    using System.Windows.Input;
7    using System.Windows.Media;
8    using System.Windows.Media.Animation;
9    using System.Windows.Shapes;
10   using System.Collections.Generic;
11   
12   namespace refresh
13   {
14      public partial class MainPage : UserControl
15      {
16      	
17      	List c = new List();
18   
19      	public MainPage()
20      	{
21      		// Required to initialize variables
22      		InitializeComponent();
23      		c.Add(new Customer{ _nome = "Josimari", _idade = "29"});
24      		c.Add(new Customer{_nome = "Wesley", _idade = "26"});
25      		c.Add(new Customer{_nome = "Renato",_idade = "31"});	
26      		
27      		this.dtGrid.ItemsSource = c;
28      	}
29   
30      	private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
31      	{
32      		c.Add(new Customer{_nome = "Maiara",_idade = "18"});
33      	}
34      	
35      }
36      
37      public class Customer
38      {
39      	public string _nome{get; set;}
40      	public string _idade{get; set;}
41      }
42   }
Where, dtGrid is my DataGrid control...
The Question is: How to get the UI Updated after adding one more register to my list.
I get to solve it setting the DataGrid's Item Source to "" and then setting to the list of Customer objects again, like that:
1    private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
2    
3    {
4    
5    c.Add(new Customer{_nome = "Maiara",_idade = "18"});
6    
7    this.dtGrid.ItemsSource="";
8    
9    this.dtGrid.ItemsSource=c;
10   
11   }
12
Is there a way to get the UI updated or the datagrid's itemsSource refreshed automatically after updating, altering or deleting an item from the list c ?
Thank you,
Josimari Martarelli