private void GroupHUByComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ImpBL bl = ImpBL.Instance; try { if (groupByComboBox.SelectedIndex == 0) { groupingDataGrid.Items.Clear(); groupingDataGrid.CanUserReorderColumns = false; groupingDataGrid.CanUserResizeColumns = false; groupingDataGrid.CanUserResizeRows = false; groupingDataGrid.CanUserSortColumns = false; var hu = bl.GroupHostingUnitsByArea(); foreach (var item in hu) { foreach (var hostingunit in item) { groupingDataGrid.Items.Add(hostingunit); } } } if (groupByComboBox.SelectedIndex == 1) { groupingDataGrid.Items.Clear(); groupingDataGrid.CanUserReorderColumns = false; groupingDataGrid.CanUserResizeColumns = false; groupingDataGrid.CanUserResizeRows = false; groupingDataGrid.CanUserSortColumns = false; foreach (var item in bl.groupHostingUnitsByRates()) { groupingDataGrid.Items.Add(item); } } if (groupByComboBox.SelectedIndex == 2) { groupingDataGrid.Items.Clear(); groupingDataGrid.CanUserReorderColumns = false; groupingDataGrid.CanUserResizeColumns = false; groupingDataGrid.CanUserResizeRows = false; groupingDataGrid.CanUserSortColumns = false; foreach (var item in bl.GroupHostingUnitsByType()) { foreach (var item2 in item) { groupingDataGrid.Items.Add(item2); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }