bool checkStyle = attribute.Selection.GetStringValue() == "Modern"; bool checkColor = false; ConfigAttribute width = null; if (!checkStyle) return ""; // No need to continue foreach (ConfigAttribute attr in config.Attributes) { if (checkStyle && checkColor && width != null) break; if (attr.val_Name == "Width") { width = attr; } 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) { // Clear the selection if less than 20 if (width.Selection.HasValue && width.Selection.GetNumericalValue() < 20) width.Selection.Set(null, false); } return "";