We have a windows application with around 50 forms. We are starting to use styling from infragistics. So we have converted a few controls of 5 forms into infragistics and some controls are still windows controls. We have prepared a style library which contains different stylesets for different forms. We have used the following function to add the styleSetName and StyleLibraryName property to all the controls in the form
public static void SetThemeProperties(Control control, String styleLibraryName, String styleSetName) { if (control != null) { PropertyDescriptorCollection tempObjectPropertyCollection = TypeDescriptor.GetProperties(control); PropertyDescriptor tempObjectStyleLibraryNameProperty = tempObjectPropertyCollection.Find("StyleLibraryName", true); PropertyDescriptor tempObjectStyleSetNameProperty = tempObjectPropertyCollection.Find("StyleSetName", true);
if (tempObjectPropertyCollection != null && tempObjectStyleLibraryNameProperty != null && tempObjectStyleSetNameProperty != null) { tempObjectStyleLibraryNameProperty.SetValue(control, styleLibraryName); tempObjectStyleSetNameProperty.SetValue(control, styleSetName); } if (control.Controls != null) { foreach (Control child in control.Controls) { SetThemeProperties(child, styleLibraryName, styleSetName); } } }
Now since the style library which is being loaded with an alias(styleLibraryName) so it does not affect other forms where the property is not set. But this also results in problem of inbox controls not being styled, since they do not have any styleSetName property. We already have dropped the InboxControlStyler on the forms.
Can you suggest some way by which we can apply the different styleSets to inbox controls on different forms.
Hi,
I think what you need to do is set the DefaultStyleLibraryName and DefaultStyleSetName properties on the InboxControlStyler itself.
Cant it be done in some common function so that I do not have to hardcode the values in each form. Is there no way it is exposed so that it can be set.