I'm totally new to WPF so heres my code:
<DataGrid x:Name="dgVarConfig" ItemsSource="{Binding varConfigList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="10,59,0,0" VerticalAlignment="Top" Height="403" Width="1278" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" HeadersVisibility="Column">
<DataGrid.Columns>
<DataGridTextColumn Width="auto" Header="Match Ausdruck" Binding="{Binding match_expression}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
My Files: MainWindow.xaml, MainController.cs, VarConfigDAO.cs
the varConfigDAO.cs returns the list to the MainController, and the MainController.cs returns it do MainWindows.xaml.
This is the VarConfig.cs:
public class VarConfig
{
public int id { get; set; }
public String group { get; set; }
public String machine { get; set; }
public String match_expression { get; set; }
public String variant_new_1 { get; set; }
public String calc_formula_1 { get; set; }
public String variant_new_2 { get; set; }
public String calc_formula_2 { get; set; }
}
It works if i set the itemssource programmaticly:
dgVarConfig.Itemssource = mainController.loadVarConfigList();
But thats not what i want because i want to update the list via the grid (insert, delete, update lines => Mode=TwoWay)
Any clue how i can fill the itemssource via xaml?