HI all,
I want to bind WPF datagrid in two way. I had tried following XAML:
<Grid>
<my:DataGrid x:Name="dataGrid" AutoGenerateColumns="False" Margin="8">
<my:DataGrid.Columns>
<my:DataGridTextColumn Header="Header" Binding="{Binding pCode}" IsReadOnly="True" />
<my:DataGridTextColumn Header="Header" Binding="{Binding pName}" IsReadOnly="True" />
<my:DataGridTextColumn Header="Header" Binding="{Binding pStock}" IsReadOnly="True" />
<my:DataGridTextColumn Header="Header" Binding="{Binding pGroup}" IsReadOnly="True" />
<my:DataGridTextColumn Header="Header" Binding="{Binding pPrice, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</my:DataGrid.Columns>
</my:DataGrid>
</Grid>
UPDATED
ProductsTableAdapters.TempTA tempTA = new WpfDataGridBinding.ProductsTableAdapters.TempTA();
Products.TempDataTable tempDT = new Products.TempDataTable();
public Window1()
{
InitializeComponent();
tempDT = tempTA.GetData();
dataGrid.ItemsSource = tempDT;
}
This is how I am binding to datagrid. Now I want to update DB whenever I change price filed in DataGrid. I more thing I would like to ask that i would update only row whose value has changed, not all rows.
Thanks Please code(help) me....