This is a migrated thread and some comments may be shown as answers.

Apply themes at runtime.

1 Answer 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Srikar
Top achievements
Rank 1
Srikar asked on 24 Oct 2011, 10:33 AM

I am using telerik Q3 2010 SP1and facing below issues.

1) Unable to change the theme of standard controls at run time.
2) Unable to apply theme for grid. I am expecting that the grid backgroud should change according to the theme.

Please refer below code and let me know how to resolve the issue.


<

 

 

UserControl x:Class="RadControlsSilverlightApp1.MainPage"

 

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

 

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"

 

 

 

xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

 

 

 

mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

 

 

 

 

<Grid x:Name="LayoutRoot" telerik:StyleManager.Theme="Expression_Dark">

 

 

 

 

<telerik:RadBusyIndicator x:Name="busy" >

 

 

 

 

<TextBox Text="SL text box" telerik:StyleManager.Theme="Office_Black" Height="100" Width="100" Margin="115,121,425,259" />

 

 

 

 

</telerik:RadBusyIndicator>

 

 

 

 

<Button Click="Button_Click" telerik:StyleManager.Theme="Office_Black" Height="100" Width="100" Content="test" Margin="518,368,22,12" />

 

 

 

 

 

</Grid>

 

</

 

 

UserControl>

 


1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 24 Oct 2011, 12:02 PM
Hi Srikar,

 

When you apply the theme at runtime indeed only RadControls will be styled - not the native ones, which are being supported by our theming mechanism. If you want to style these native controls based on the current application theme you should manually set the corresponding theme, as shown below:

App.xaml:

             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             x:Class="RadCalcTest.App"
             >
    <Application.Resources>
        <Style TargetType="Button"/>
    </Application.Resources>
</Application>

App.xaml.cs:

public App()
      {
          this.Startup += this.Application_Startup;
          this.Exit += this.Application_Exit;
          this.UnhandledException += this.Application_UnhandledException;
          StyleManager.ApplicationTheme = new Windows7Theme();
          InitializeComponent();
         StyleManager.SetBasedOn(((Style)Current.Resources[typeof(Button)]), StyleManager.ApplicationTheme);
      }


Regarding your second question I believe that the following forum thread might be of help. 

All the best,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Srikar
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question
or