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

Parents
No Data
Reply
  • 394
    posted

    I've done some more digging and I tried this:

            If String.IsNullOrEmpty(Infragistics.Win.AppStyling.StyleManager.DefaultStyleSetName) _

             OrElse Infragistics.Win.AppStyling.StyleManager.DefaultStyleSetName.Equals("Default") Then

                Infragistics.Win.AppStyling.StyleManager.SetDefaultStyleSetName(Nothing, "White")

            Else

                Infragistics.Win.AppStyling.StyleManager.SetDefaultStyleSetName(Nothing, "Default")

            End If

    It does not work unless I specify the StyleSetName property for the Infraigstics control I want to switch; e.g.

            If String.IsNullOrEmpty(Infragistics.Win.AppStyling.StyleManager.DefaultStyleSetName) _

             OrElse Infragistics.Win.AppStyling.StyleManager.DefaultStyleSetName.Equals("Default") Then

                [NameOfInfragisticsControl].StyleSetName = "White"

                Infragistics.Win.AppStyling.StyleManager.SetDefaultStyleSetName(Nothing, "White")

            Else

                [NameOfInfragisticsControl].StyleSetName = String.Empty

                Infragistics.Win.AppStyling.StyleManager.SetDefaultStyleSetName(Nothing, "Default")

            End If

     

    This is no good for me as I want to be able to change the background (for example) by a single click for all Infragistics controls.

Children