Themes not working

7 posts, 0 answers
  1. Stephen Miller
    Stephen Miller avatar
    5 posts
    Member since:
    May 2010

    Posted 10 Jun 2010 Link to this post

    Greetings,

    I have used all of the themes and none of them work when running the program.  When I do the development in Blend, the visualizer shows different themes, although Summer does not look like it does when used in a dock tabcontrol with the sweeping curved edge - it still has rectangles for tabitem headers.  When I run the application, the tab control looks exactly the same regardless of the theme.  I am following the example verbatim and it does not work...  I have attached a set of screen shots with examples of all themes with Blend displayed over the app when it runs...

    Thanks,
    Steve
  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 16 Jun 2010 Link to this post

    Hello Stephen ,

    Please, accept our apologies for the late reply.
    In the link below you can see all the themes for the RadTabControl :
    http://demos.telerik.com/silverlight/#TabControl/FirstLook

    In the RadDocking, however, we use a custom theme for the TabControl. If you want to design the TabControl to look as the TabControl in RadDocking you have to edit its control template in Blend. For more information you can follow the link below:
    http://www.telerik.com/help/silverlight/radcontrols-for-silverlight-expression-blend-support.html 

    If you have further questions please do not hesitate to ask us.
    I hope this will help you.

    All the best,
    Dimitrina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Allen
    Allen avatar
    50 posts
    Member since:
    Mar 2011

    Posted 23 Feb 2012 Link to this post

    OK, something odd is happening with these themes.  I have a mainwindow with a single tab control on it, which has 4 tab items.  Whether the content of these items is a complex user control or just a RadButton, the tab and the FIRST tab item content will only take on the theme of the application 1 time only, on startup and will never retheme.  All the other tab buttons do in fact retheme dynamically.

    My app.xaml (based on posts elsewhere here) is as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <Application x:Class="AASHTO.ElementMigration.VisualElementMigrator.App"
                 x:Name="VisualElementMigrator"
                 StartupUri="Views/MainWindow.xaml"
                 Startup="Application_Startup"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 xmlns:hlprs="clr-namespace:AASHTO.ElementMigration.VisualElementMigrator.Helpers"
                 xmlns:Converters="clr-namespace:AASHTO.ElementMigration.VisualElementMigrator.Converters"
                 xmlns:vm="clr-namespace:AASHTO.ElementMigration.VisualElementMigrator.ViewModel"
                 xmlns:Drawing="clr-namespace:System.Drawing;assembly=System.Drawing"
                 xmlns:p1="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"              
                 mc:Ignorable="d">
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
     
                    <!-- MVVM Related -->
                    <ResourceDictionary>
                        <!--Global View Model Locator-->
                        <vm:ViewModelLocator x:Key="Locator" />
                    </ResourceDictionary>
     
                    <!-- Converters-->
                    <ResourceDictionary>
                        <!-- used to convert some number of grid rows into a nicer page size of rows per page-->
                        <Converters:DataPagerRowCountPageSizeConverter x:Key="rowCountPageSizeConverter" />
                        <!-- This TypeConverter shows the binding values in the debugger as they are bound -->
                        <Converters:DatabindingDebugConverter x:Key="databindingDebugConverter" />
                        <!-- Supports binding a button to a theme / collection -->
                        <Converters:TelerikThemeBindingConverter x:Key="themeBindingConverter" />
                        <!-- these two type converters are used with UI elements to enable/disable and show / hide/ collapse-->
                        <Converters:IntToBoolConverter x:Key="IntToBoolConverter" />
                        <Converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" />
                    </ResourceDictionary>
     
                    <!-- Styles -->
                    <ResourceDictionary Source="pack://application:,,,/VisualElementMigrator;component/LookAndFeel/Styles/MainStyles.xaml" />
     
                    <!-- Application Theme -->
                    <ResourceDictionary>
                  
                        <telerik:Theme x:Key="TelerikGlobalTheme">Office_Blue</telerik:Theme>
      
                        <Style BasedOn="{x:Null}" TargetType="Grid">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="GridSplitter">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                          <!-- Must specify for all control types to force a dynamic theme update -->
                        <Style BasedOn="{x:Null}" TargetType="{x:Type Button}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type CheckBox}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ComboBox}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type Expander}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type GroupBox}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type Label}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ListBox}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ListView}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type Menu}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type PasswordBox}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ProgressBar}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type RadioButton}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type RichTextBox}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ScrollBar}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type Slider}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type Separator}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type StatusBar}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type TabControl}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type TabItem}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type TextBlock}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ToolBar}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ToolBarPanel}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type ToolBarTray}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="{x:Type TreeView}">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
                        <!-- This allows for dynamic changing of themes -->
          
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadButtonGroup">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
                        <!-- Docking -->
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadDocking">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadSplitContainer">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
                        <!-- Navigation -->
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadDataPager">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadPane">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadDocumentPane">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadPaneGroup">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadContextMenu">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadMenu">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadMenuItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:Separator">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadTileView">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadTileViewItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadTabControl">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadTabItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadOutlookBar">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadOutlookBarItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadPanelBar">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadPanelBarItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadToolBar">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadToolBarSeparator">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadToolBarTray">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadTreeView">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadTreeViewItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:CarouselItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadCarousel">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadCarouselPanel">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadWindow">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
                        <!--Gauge type is now obsolete -  replaced in Q3 2011 by multiple distinct guage types
                <Style BasedOn="{x:Null}" TargetType="telerik:RadGuage">
                    <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                </Style>
          -->
     
                        <!-- Grid -->
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadGridView">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
                        <!-- Scheduler is obsolete - replaced with RadScheduleView
                <Style BasedOn="{x:Null}" TargetType="telerik:RadScheduler">
                    <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                </Style>
    -->
     
                        <!-- Controls -->
     
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadButton">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadDropDownButton">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadRadioButton">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadSplitButton">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadToggleButton">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadExpander">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadWrapPanel">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadProgressBar">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadSlider">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
                        <!-- Input -->
     
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadCalendar">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadColorPaletteView">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadColorPaletteViewItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadColorPicker">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadColorSelector">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadComboBox">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadComboBoxItem">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadDatePicker">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadMaskedTextBox">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadNumericUpDown">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadClock">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
                        <Style BasedOn="{x:Null}" TargetType="telerik:RadTimePicker">
                            <Setter Property="telerik:StyleManager.Theme" Value="{DynamicResource TelerikGlobalTheme}" />
                        </Style>
     
     
     
                        <!-- Doesnt work.
            <Style BasedOn="{x:Null}" TargetType="telerik:StyleManager">
                <Setter Property="ApplicationTheme" Value="{DynamicResource TelerikGlobalTheme}" />
            </Style>
            -->
                    </ResourceDictionary>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
     
        </Application.Resources>
    </Application>


    The theme part of this is supposed to dynamically retheme standard windows controls as well as Rad Controls.   Yes, it does, sort of.

    So I have a method to apply the theme based on a selection of a them  /// <summary>
         
    /// <summary>
          ///   Set the theme to the passed theme name string
          /// </summary>
          /// <param name = "themeInternalName"></param>
          /// <param name="forceThemeChange"> Makes the theme change happen regardless</param>
          public void SetTheme(string themeInternalName, bool forceThemeChange = false)
          {
              //* Currently Telerik RadControls support the following themes out of the box:
              //* Office_Black
              //* Office_Blue
              //* Office_Silver
              //* Summer
              //* Vista
              //* Windows 7
              //* Transparent
              //* Expression_Dark
              //* Metro
     
              var themeNameTest = themeInternalName ??
                                  (Settings.Default.ActiveTheme ??
                                   "Office_Blue");
              try
              {
                  if (themeNameTest != Application.Current.FindResource("TelerikGlobalTheme").ToString() || forceThemeChange)
                  {
                      // Verify themeInternalName is in the set of valid themeNames..
                      // this cannot happen unless the string is not a valid Telerik theme internal name
                      if (!ThemeManager.StandardThemeNames.Contains(themeNameTest))
                          throw new ArgumentException(string.Format("Theme name switch failed - theme {0} does not exist in the standard themes", themeNameTest), "themeNameTest");
                      // set the visual theme we are using
                      Theme newTheme =  ThemeManager.FromName(themeNameTest);
                      Application.Current.Resources["TelerikGlobalTheme"] = newTheme;
                      StyleManager.ApplicationTheme = newTheme;  // (Telerik.Windows.Controls.Theme)Application.Current.FindResource("TelerikGlobalTheme");
                      Settings.Default.ActiveTheme = themeNameTest; // Themes.GetFamiliarThemeName(StyleManager.ApplicationTheme.ToString());
                      Settings.Default.Save();
                  }
              }
              catch (ArgumentException argEx)
              {
                  var msg =
                      string.Format(
                          "Target Theme Name {0} is invalid!  Setting to default theme {1} .  Exception was {2}",
                          themeNameTest, ThemeManager.StandardThemeNames[0], argEx);
                  Logger.Debug(msg);
                  //figure out the visual theme we are using by taking the first one
                  StyleManager.ApplicationTheme =
                      ThemeManager.FromName(ThemeManager.StandardThemeNames[0]);
              }
              catch (Exception ex)
              {
                  Logger.ErrorFormat("An unexpected exception has occurred." + Environment.NewLine +
                                     "StyleManager.ApplicationTheme could not be set! Setting to default theme {1} .  Exception was {2}",
                                     ThemeManager.StandardThemeNames[0], ex);
     
                  //figure out the visual theme we are using by taking the first one which is (likely) Office_Blue
                  StyleManager.ApplicationTheme =
                      ThemeManager.FromName(ThemeManager.StandardThemeNames[0]);
                  Telerik.Windows.Controls.Theme newTheme = Telerik.Windows.Controls.ThemeManager.FromName(ThemeManager.StandardThemeNames[0]);
                  Application.Current.Resources["TelerikGlobalTheme"] = newTheme;
              }
          }

    The theme INTERNAL NAME is stored in properties so it can be reapplied next time.  Default is OFFICE_BLUE.

    THe theme name e.g. Office_Black is squirted into the resource  TelerikGlobalTheme and becomes the StyleManager.ApplicationTheme.

    Every control and the window as a whole react to this EXCEPT the overall TabControl and the content of the FIRST TabItem.  The other tabs' content which are also buttons happily retheme.  I have tried this both with direct entry of the tab items and by creating them on the fly from a collection using the TabControl ItemsSource. Makes no difference.

    Even worse, it appears that the TabControl and the content of its first tabitem are somehow not in the same visual tree as the rest of the app, because I am getting a message like ;(some) control is already the child of another control - please disconnect it first - which I cannot figure out to save my life.

    The MainWindow stuff of intereest looks like:

    <telerik:RadTabControl  telerik:StyleManager.Theme="{StaticResource TelerikGlobalTheme}">
            <telerik:RadTabItem x:Name="RulesEditorElementTabItem4"                      
                B4_AppLibrary:Custom.ContextHelpId="RulesManagerTabToolTipId">
                <telerik:RadTabItem.Header>
                    <Grid>
                        <StackPanel Orientation="Horizontal">
                            <Image Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Icons/script.png"
                        Height="16" Width="16" />
                            <TextBlock Text="Edit Migrator Rules" Margin="3,0,0,0" />
                        </StackPanel>
                    </Grid>
                </telerik:RadTabItem.Header>
                <telerik:RadButton x:Name="radButtonExit4" Margin="20,0,0,0"
                                xaml4word:Custom.ContextHelpId="ExitApplicationToolTipId"
                                Command="{Binding ShutdownCommand}"                                  
                                Height="40" Width="80"
                                VerticalAlignment="Center"
                                VerticalContentAlignment="Center"
                                HorizontalAlignment="Center"
                                HorizontalContentAlignment="Center">
                    <telerik:RadButton.ContentTemplate>
                        <DataTemplate>
                            <DockPanel>
                                <TextBlock DockPanel.Dock="Left" TextAlignment="Center" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Exit" />
                                <Separator Width="4" Visibility="Hidden" />
                                <Image DockPanel.Dock="Right"   Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Menu/Dialog-Close.png" />
                            </DockPanel>
                        </DataTemplate>
                    </telerik:RadButton.ContentTemplate>
                </telerik:RadButton>
                <!--<Controls:RulesManager x:Name="RulesManagerControl" 
                    B4_AppLibrary:Custom.ContextHelpId="RulesManagerControlToolTipId"/>-->
            </telerik:RadTabItem>
            <telerik:RadTabItem x:Name="RulesEditorElementTabItem"                   
                B4_AppLibrary:Custom.ContextHelpId="RulesManagerTabToolTipId">
            <telerik:RadTabItem.Header>
                <Grid>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Icons/script.png"
                        Height="16" Width="16" />
                        <TextBlock Text="Edit Migrator Rules" Margin="3,0,0,0" />
                    </StackPanel>
                </Grid>
            </telerik:RadTabItem.Header>
            <telerik:RadButton x:Name="radButtonExit1" Margin="20,0,0,0"
                                xaml4word:Custom.ContextHelpId="ExitApplicationToolTipId"
                                Command="{Binding ShutdownCommand}"                                  
                                Height="40" Width="80"
                                VerticalAlignment="Center"
                                VerticalContentAlignment="Center"
                                HorizontalAlignment="Center"
                                HorizontalContentAlignment="Center">
                <telerik:RadButton.ContentTemplate>
                    <DataTemplate>
                        <DockPanel>
                            <TextBlock DockPanel.Dock="Left" TextAlignment="Center" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Exit" />
                            <Separator Width="4" Visibility="Hidden" />
                            <Image DockPanel.Dock="Right"   Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Menu/Dialog-Close.png" />
                        </DockPanel>
                    </DataTemplate>
                </telerik:RadButton.ContentTemplate>
            </telerik:RadButton>
                <!--<Controls:RulesManager x:Name="RulesManagerControl" 
                    B4_AppLibrary:Custom.ContextHelpId="RulesManagerControlToolTipId"/>-->
        </telerik:RadTabItem>
        <telerik:RadTabItem x:Name="CoReElementTabItem"
                    B4_AppLibrary:Custom.ContextHelpId="SourceCoreElementDataTabToolTipId" >
            <telerik:RadTabItem.Header>
                <Grid>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Icons/Download.png"
                        Height="16" Width="16" />
                        <TextBlock  Text="CoRe Elements"  Margin="3,0,0,0" />
                    </StackPanel>
                </Grid>
            </telerik:RadTabItem.Header>
            <telerik:RadButton x:Name="radButtonExit2" Margin="20,0,0,0"
                                xaml4word:Custom.ContextHelpId="ExitApplicationToolTipId"
                                Command="{Binding ShutdownCommand}"                                  
                                Height="40" Width="80"
                                VerticalAlignment="Center"
                                VerticalContentAlignment="Center"
                                HorizontalAlignment="Center"
                                HorizontalContentAlignment="Center">
                <telerik:RadButton.ContentTemplate>
                    <DataTemplate>
                        <DockPanel>
                            <TextBlock DockPanel.Dock="Left" TextAlignment="Center" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Exit" />
                            <Separator Width="4" Visibility="Hidden" />
                            <Image DockPanel.Dock="Right"   Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Menu/Dialog-Close.png" />
                        </DockPanel>
                    </DataTemplate>
                </telerik:RadButton.ContentTemplate>
            </telerik:RadButton>
            <!--<Controls:CoReElementDataManager x:Name="CoReElementDataManagerControl"
                        B4_AppLibrary:Custom.ContextHelpId="CoReElementDataManagerControlToolTipId"/>-->
        </telerik:RadTabItem>
        <telerik:RadTabItem x:Name="AASHTOElementTabItem" 
                    B4_AppLibrary:Custom.ContextHelpId="MigratedNbeBmeAdeDataTabToolTipId">
            <telerik:RadTabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <Image Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Icons/database_go.png"
                        Height="16" Width="16" />
                    <TextBlock Text="AASHTO Elements - NBE/BME/ADE" Margin="3,0,0,0" />
                </StackPanel>
            </telerik:RadTabItem.Header>
            <telerik:RadButton x:Name="radButtonExit3" Margin="20,0,0,0"
                                xaml4word:Custom.ContextHelpId="ExitApplicationToolTipId"
                                Command="{Binding ShutdownCommand}"                                  
                                Height="40" Width="80"
                                VerticalAlignment="Center"
                                VerticalContentAlignment="Center"
                                HorizontalAlignment="Center"
                                HorizontalContentAlignment="Center">
                <telerik:RadButton.ContentTemplate>
                    <DataTemplate>
                        <DockPanel>
                            <TextBlock DockPanel.Dock="Left" TextAlignment="Center" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Exit" />
                            <Separator Width="4" Visibility="Hidden" />
                            <Image DockPanel.Dock="Right"   Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Menu/Dialog-Close.png" />
                        </DockPanel>
                    </DataTemplate>
                </telerik:RadButton.ContentTemplate>
            </telerik:RadButton>
            <!--<Controls:AASHTOElementDataManager x:Name="AASHTOElementDataManagerControl"
                      B4_AppLibrary:Custom.ContextHelpId="AASHTOElementDataManagerControlToolTipId"/>-->
        </telerik:RadTabItem>
        <telerik:RadTabItem x:Name="SetupTabItem"
                B4_AppLibrary:Custom.ContextHelpId="SetupTabToolTipId">
            <telerik:RadTabItem.Header>
                <Grid>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="pack://application:,,,/ResourceLibrary;component/Resources/Images/Icons/Config.png"
                        Height="16" Width="16" />
                        <TextBlock Text="Settings" Margin="3,0,0,0" />
                    </StackPanel>
                </Grid>
            </telerik:RadTabItem.Header>
            <Controls:UseCaseSettingsManager x:Name="UseCaseSettingsView"
                     B4_AppLibrary:Custom.ContextHelpId="UseCaseSettingsManagerToolTipId"/>
        </telerik:RadTabItem>
    </telerik:RadTabControl>

    There are 4 tab items.  Content of Tabs 2-4 all retheme as expected  There is a buttongroup on this page that rethemes, and another usercontrol that rethemes - only the tabcontrol and the content of its first tab do not react.

    It is like the tab does not listen to the stylemanager.  How can that be?


    HELP!
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 24 Feb 2012 Link to this post

    Hello Allen,

    Unfortunately, it is very hard for us to investigate this issue in depth. We cannot run these snippets, because we don't have all your files needed. Furthermore, our StyleManager does not support changing the Application Theme runtime. Is it possible for you to isolate this in a sample project that we could debug and advice you faster this way ?You can open a new support ticket with he project attached or we can change this ticket to GeneralFeedBack and you will be able to attach files.
    Thank you in advance.

    Regards,
    Petar Mladenov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. HoriaTu
    HoriaTu avatar
    2 posts
    Member since:
    Apr 2013

    Posted 10 Jul 2013 Link to this post

    What is new after three years on this subject?

    I have followed the instructions from
    http://www.telerik.com/help/wpf/styling-apperance-themes-runtime.html

    It looks like RadDocking have the same issue!
  7. Allen
    Allen avatar
    50 posts
    Member since:
    Mar 2011

    Posted 10 Jul 2013 Link to this post

    I never got this to work on demand at runtime.  I finally went with a model that switched the theme, showed a preview thereof, and restarted the application to use the new theme.
  8. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 15 Jul 2013 Link to this post

    Hello,

    The only issue related to changing the theme of RadDocking at runtime we're aware of is the following one:
    http://www.telerik.com/support/pits.aspx#/public/silverlight/7386

    If you're experiencing a different problem, please send us more details about your project,  so we to be able to research it.

    Regards,
    Yana
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready