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
394
New to AppStylist - How to switch between styles
posted

I am new the navigating this website and the Infragistics controls and was wondering how I can switch between StyleSets at runtime

I am loading my ISL file on application startup:

                Dim defaultTheme As System.IO.Stream = executingAssembly.GetManifestResourceStream("MyApp.Default.isl")

                If defaultTheme IsNot Nothing Then

                    Infragistics.Win.AppStyling.StyleManager.Load(defaultTheme)

                End If

And then I want to be able to have an Options screen where the user can select the alternative StyleSet called "White" within the ISL file and it will automatically update all the Infragistics controls to use the new StyleSet.
What is the C# or VB.NET to do this switch at runtime?
Thanks

  • 394
    posted

    I thought maybe this would work, but it does NOT seem to work...

            Dim styleLibrary As New Infragistics.Win.AppStyling.Runtime.ApplicationStyleLibrary()

            styleLibrary.LoadFromStyleManager()

            If String.IsNullOrEmpty(styleLibrary.DefaultStyleSet) Then

                styleLibrary.DefaultStyleSet = "White"

                Me.BackColor = Color.White

            Else

                styleLibrary.DefaultStyleSet = Nothing

                Me.BackColor = Color.WhiteSmoke

            End If

            styleLibrary.UpdateStyleManager()