private void MsgHub_MessageRecevied(object sender, MessageType type, object data) { switch (type) { case MessageType.AppClosing: case MessageType.AppClosed: case MessageType.ProjectClosed: //case MessageType.XlatorSelected: DgMappingSummary.ItemsSource = null; break; case MessageType.ProjectOpened: case MessageType.DataReload: // ReloadList() var cvs = new CollectionViewSource { Source = TranslatorHelpers.CurrentUsedModels }; switch (CbSummaryGroupBy.SelectedIndex) { case 1: // File Name cvs.GroupDescriptions.Add(new PropertyGroupDescription(nameof(MappingMonitor.MappingModel.ProjectBasedFileName))); break; default: // Category cvs.GroupDescriptions.Add(new PropertyGroupDescription(nameof(MappingMonitor.MappingModel.Category), new TextCategoryL10nItemsConverter())); break; } DgMappingSummary.ItemsSource = cvs.View; break; case MessageType.XlatingSections: if (data is bool onOffSections && onOffSections == false) { DgMappingSummary.UpdateLayout(); } break; case MessageType.XlatingQuick: if (data is bool onOffQuick && onOffQuick == false) { DgMappingSummary.UpdateLayout(); } break; } }
private void CbSummaryGroupBy_SelectionChanged(object sender, SelectionChangedEventArgs e) { var cv = DgMappingSummary.ItemsSource as ICollectionView; if (cv == null || cv.SourceCollection == null) { return; } cv.GroupDescriptions.Clear(); switch (CbSummaryGroupBy.SelectedIndex) { case 1: // File Name cv.GroupDescriptions.Add(new PropertyGroupDescription(nameof(MappingMonitor.MappingModel.ProjectBasedFileName))); break; default: // Category cv.GroupDescriptions.Add(new PropertyGroupDescription(nameof(MappingMonitor.MappingModel.Category), new TextCategoryL10nItemsConverter())); break; } DgMappingSummary.UpdateLayout(); }