Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
795
Applying specific styleset to windows controls
posted

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.