S
S
SennaTOR2015-03-26 15:07:53
WPF
SennaTOR, 2015-03-26 15:07:53

Binding GridView WPF to Entity Framework. How to update the GridView when a row changes, which should no longer be in the selection?

There is a RadGridView from Telerik. There is a table in the database with the id_status field. Uses Entity Framework 6.0 for binding.

ordersDb.Orders.Where(t => t.id_status!= 4 && t.id_status != 6).Load();
gridOrders.ItemsSource = ordersDb.Orders.Local.ToBindingList();

When deleting row in handler RadGridView updates successfully
Order ord = ordersDb.Orders.Find((gridOrders.SelectedItem as Order).Id);
ordersDb.Orders.Remove(ord);
ordersDb.SaveChanges();

If I change id_status to 6, so that this line should no longer be displayed, then the form is not updated.
ordersDb.Orders.Find((gridOrders.SelectedItem as Order).Id).id_status = 6;
ordersDb.SaveChanges();
ordersDb.Tickets.Where(t => t.id_status != 4 && t.id_status != 6).Load();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question