bool checkStyle = false; bool checkColor = false; foreach (ConfigAttribute attr in config.Attributes) { if (checkStyle && checkColor) break; if (attr.val_Name == "Style") { // Check the style if (attr.Selection.GetStringValue() == "Modern") checkStyle = true; else return ""; // No need to continue } else if (attr.val_Name == "Color") { // Check the color if (attr.Selection.GetStringValue() == "Wood") checkColor = true; else return ""; // No need to continue } } if (checkStyle && checkColor) { // Apply the restriction: change the minimum value to '20' range.MinValue = 20; } return "";