Apply theme to just the current Dialog

4 posts, 0 answers
  1. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 18 Apr 2013 Link to this post

    how can I change the theme for just the current form at runtime and not the whole application 

    This is for a dialog form that opens in front of the main form that has a different theme

    ThemeResolutionService.ApplicationThemeName = ThemeName
     This changes the theme for the whole application not just the open dialog and the following seems to not work at all 

    Private Sub ApplyTheme()
     
           Dim mytheme As New Telerik.WinControls.Themes.Office2010BlackTheme
     
           Me.ThemeClassName = "Telerik.WinControls.UI.RadForm"
           Me.ThemeName = mytheme.ThemeName
     
       End Sub

  2. Anton
    Admin
    Anton avatar
    167 posts

    Posted 23 Apr 2013 Link to this post

    Hi Denis,

    Thank you for writing.

    The theme that is set through ApplicationThemeName property of ThemeResolutionService is with higher priority than the locally set themes to controls. However, you can use the ApplyThemeToControlTree method of the ThemeResolutionService and apply the theme to the form. In this case the locally set themes will not be ignored. However, you should apply the main theme to all forms in your application.

    Attached is the demo project that demonstrates how to use the ApplyThemeToControlTree method.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Greetings,
    Anton
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 23 Apr 2013 Link to this post

    Hi Thanks Anton

    I cant seem to get this implemented, will try it again, my forms are just stubborn I suppose

    Also the code you supplied does not include the Office2010BlackTheme  Theme as you have targeted the newer build

    Thus I cannot use your code as it currently stand 

    Denis
  5. Anton
    Admin
    Anton avatar
    167 posts

    Posted 26 Apr 2013 Link to this post

    Hello Denis,

    Thank you for writing back.

    I created a new demo to demonstrate more clearly how to use the ApplyThemeToControlTree method to change the theme of the form at run time.

    I hope this demo helps.

    All the best,
    Anton
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top