private void LoadData() { try { var list = _logic.Read(null); if (list != null) { DataGridView.ItemsSource = list; DataGridView.Columns[0].Visibility = Visibility.Hidden; DataGridView.Columns[4].Visibility = Visibility.Hidden; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void LoadData() { _supplys.Clear(); List <SupplyViewModel> supplys = _logic.Read(new SupplyBindingModel { DateTo = dpTo.SelectedDate, DateFrom = dpFrom.SelectedDate }); foreach (var supply in supplys) { int count = 0; foreach (var material in supply.SupplyMaterials) { count += material.Value.Item2; } _supplys.Add(new ChartSupplyViewModel { SupplyName = supply.Name, MaterialCount = count }); } DataGridView.ItemsSource = _supplys; DataGridView.Items.Refresh(); }