Hi all,
I want to connect WPat datagrid in two ways. I 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 get attached to a datagrid. Now I want to update the database whenever I change the price submitted to the DataGrid. I want to say more that I would only update a row whose value has changed, and not all rows.
Thank you. Please write to me (help) ....
source
share