private void RadioButton_Click(object sender, RoutedEventArgs e) { if (!(sender is Button)) { return; } TabItem ti = (TabItem)experimentTabControl.ItemContainerGenerator.ContainerFromIndex(experimentTabControl.SelectedIndex); if (ti.Name == "displaysTab") { DisplaysTabRadioButton_Click(sender, e); return; } Button button = (Button)sender; string operatorName = (string)button.Tag; MeasureSelection content = (MeasureSelection)measuresDataGrid.CurrentItem; bool allOperator = (string.Compare(operatorName, "All") == 0); bool isCategory = (content.MeasureRowType == MeasureRowType.CategoryType); bool isSubCategory = (content.MeasureRowType == MeasureRowType.SubCategoryType); RadioButtonType newValue = RadioButtonType.Off; RadioButtonType currentValue = RadioButtonType.Off; bool isOperator = operatorName.Contains("Operator"); int operatorIndex = 0; if (string.Compare("All", operatorName) == 0) { currentValue = content.All; } else if (isOperator) { operatorIndex = int.Parse(operatorName.Replace("Operator", "")) - 1; currentValue = content[operatorIndex]; } else { return; } if ((currentValue == RadioButtonType.Off) || (currentValue == RadioButtonType.Partial)) { newValue = RadioButtonType.On; } else { newValue = RadioButtonType.Off; } if (content.MeasureRowType == MeasureRowType.CategoryType) { string categoryName = content.MeasureName; for (int j = 0; j < measureDataModel.Count; j++) { if ((measureDataModel[j].MeasureRowType == MeasureRowType.DataValue) && (string.Compare(categoryName, measureDataModel[j].Category) == 0)) { if (string.Compare("All", operatorName) == 0) { measureDataModel[j].All = newValue; for (int i = 0; i < measureDataModel.NumOperators; i++) { measureDataModel[j][i] = newValue; } } else if (isOperator) { measureDataModel[j][operatorIndex] = newValue; } } } } else if (content.MeasureRowType == MeasureRowType.SubCategoryType) { string subCategoryName = content.MeasureName; for (int j = 0; j < measureDataModel.Count; j++) { if ((measureDataModel[j].MeasureRowType == MeasureRowType.DataValue) && (string.Compare(subCategoryName, measureDataModel[j].SubCategory) == 0)) { if (string.Compare("All", operatorName) == 0) { measureDataModel[j].All = newValue; for (int i = 0; i < measureDataModel.NumOperators; i++) { measureDataModel[j][i] = newValue; } } else if (isOperator) { measureDataModel[j][operatorIndex] = newValue; } } } } else if (content.MeasureRowType == MeasureRowType.DataValue) { if (string.Compare("All", operatorName) == 0) { content.All = newValue; for (int i = 0; i < measureDataModel.NumOperators; i++) { content[i] = newValue; } } else if (isOperator) { content[operatorIndex] = newValue; } } // Recalculate all rollups measureDataModel.RefreshAllCol(); // Recalculate Subcategory rollups measureDataModel.RefreshSubCategory(); // Recalculated Category rollups measureDataModel.RefreshCategory(); }