private void OrdersList_SelectionChanged(object sender, SelectionChangedEventArgs e) { DateTime orderDate = (DateTime)OrdersList.SelectedItem; var selectedOrder = zzaEntities.Orders.Include("OrderItems"). Where(o => o.OrderDate == orderDate && o.CustomerId == (Guid)CustomerIdLabel.Content).FirstOrDefault(); viewModel.OrderItems = selectedOrder.OrderItems.ToList(); DataContext = viewModel; OrderItemsDataGrid.GetBindingExpression(DataGrid.ItemsSourceProperty).UpdateTarget(); }
public void RefreshOrderItemsDataGrid() { OrderItemsDataGrid?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget(); OrderItemsDataGrid?.Items.Refresh(); }