/// <summary> /// Set the properties defined in the styles sheet file /// for the "c" control using the style name specified as parameter. /// </summary> /// <param name="control">the control</param> /// <param name="styleName">the name of the style to applied</param> public void ApplyStyle(Control control, string styleName) { if (!styleName.Equals(string.Empty)) { Style style = GetStyle(styleName); if (style == null) throw new StylesSheetException(StylesSheetException.ExceptionType.StyleNotPresentInStylesSheetFile, styleName, control.Name, String.Empty, String.Empty); PropertySetter setter = new PropertySetter(); foreach (Property property in style.Properties) { if (property.Name == null) throw new StylesSheetException(StylesSheetException.ExceptionType.PropertyNameTagNotFound, styleName, String.Empty, String.Empty, String.Empty); if (property.Value == null) throw new StylesSheetException(StylesSheetException.ExceptionType.PropertyValueTagNotFound, styleName, String.Empty, property.Name, String.Empty); setter.Set(styleName, control, property.Name, property.Value); } } }