Synchronize Item Source in DataGrid WPF

Oct 1, 2008 at 6:52 AM
Edited Oct 1, 2008 at 6:56 AM
so the question is the next$0We have WPF DataGrid, several bindined columns and item source for this data grid.$0$0After selecting item source we begin to edit data in datagrid, BUT IN ITEM SOURCE DATA DOESN'T CHANGE!$0$0the example:$0$0List<Fields> fList = new List<Fields>();$0$0Fields currentField = new Fields();$0$0$0$0$0private void reLoadCurrentFildControls()$0$0 {  $0$0 dataGrid1.Items.Clear();$0$0 datagrid1.ItemsSource = fList;$0$0 }$0$0$0$0$0private void button1_Click(object sender, RoutedEventArgs e)$0$0{$0$0currentField.F1 = textBox1.Text;$0$0currentField.F2 = textBox2.Text;$0$0textBox1.Clear();$0$0textBox2.Clear();$0$0fList.Add(currentField);$0$0reLoadCurrentFildControls();$0$0}$0
XAML:$0$0<TextBox Height="23" HorizontalAlignment="Left" Name="textBox1" VerticalAlignment="Top" Width="166" Margin="0,27,0,0" />$0$0<TextBox Height="23" HorizontalAlignment="Left" Margin="0,73,0,0" Name="textBox2" VerticalAlignment="Top" Width="166" />$0$0<Label Height="28" Name="label1" VerticalAlignment="Top" Width="120" HorizontalAlignment="Left">Field 1</Label>        <Label Height="28" HorizontalAlignment="Left" Margin="0,47,0,0" Name="label2" VerticalAlignment="Top" Width="120">$0$0Field 2</Label>$0$0$0$0<Button Height="23" HorizontalAlignment="Left" Margin="91,102,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click">Add</Button>$0$0<my:DataGrid Margin="172,156,0,0" Name="dataGrid1" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" Height="139" VerticalAlignment="Top">$0$0	<my:DataGrid.Columns>$0$0		<my:DataGridTextColumn Header="Поле 1" DataFieldBinding="{Binding F1}"/>$0$0		<my:DataGridTextColumn Header="поле 2" DataFieldBinding="{Binding F2}"/>$0$0	</my:DataGrid.Columns>$0$0</my:DataGrid>$0$0$0$0What i need to do? to Synchronize data in dataGrid with itemSource?$0$0$0