Datagrid LINQ binding

Nov 12, 2009 at 7:38 PM

Ok, i have a LINQ to SQl class and a datagrid, how do I bind them so that any changes are reflected in the datagrid?

At the moment I have

db = new DataClasses1DataContext();


in a click event i have
private void button2_Click(object sender, RoutedEventArgs e)


            Product newProduct = new Product();

            newProduct.productName = name.Text;

            newProduct.category = category.Text;

            newProduct.weight = double.Parse(weight.Text);

            newProduct.price = decimal.Parse(price.Text);

            newProduct.stock = int.Parse(stock.Text);

            newProduct.lowStockLevel = int.Parse(lowstock.Text);

            newProduct.autoOrderAmount = int.Parse(autoorderamount.Text);

            newProduct.description = description.Text;




This does insert the new item but it seems that whatever I try I can't get the datagrid to reflect the change?