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

Chaning themes dynamically

8 Answers 111 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
CJ chavez
Top achievements
Rank 1
CJ chavez asked on 26 May 2010, 09:24 PM
Hi guys,

can you guys show me how to change themes for a particular page(User Control) or a ribbon bar(in my case)
either with the themes you guys provide or the ones from the tool kit from silverlight,

thanks in advance!

8 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 27 May 2010, 03:43 PM
Hello CJ chavez,

 The StyleManager class that ships with our controls possesses the Theme attached property that attaches to all our UI controls. You can change the theme of a control by changing that property. I'm attaching a sample solution where I've bound the Theme property of a RadGridView to a ComboBox of themes and choosing a different theme from the ComboBox changes the theme of the GridView. 

Sincerely yours,
Yavor Georgiev
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.
0
CJ chavez
Top achievements
Rank 1
answered on 27 May 2010, 03:46 PM
thanks! i'll look into it...
0
CJ chavez
Top achievements
Rank 1
answered on 27 May 2010, 04:50 PM
so I ran your solution but when i change the combo box value the theme does not change... :(
0
CJ chavez
Top achievements
Rank 1
answered on 27 May 2010, 06:28 PM
<telerikRibbonBar:RadRibbonBar telerik:StyleManager.Theme="Office_Silver"  Grid.ColumnSpan="2" Height="175"  HorizontalAlignment="Left" x:Name="radRibbonBar1" VerticalAlignment="Top" Width="989" ApplicationName="myAppl Web" ApplicationButtonImageSource="/RibbonbarNavigationPOC;component/Images/myimg.png" Grid.RowSpan="2" SelectedTabChanged="radRibbonBar1_SelectedTabChanged"
             
...... 
even statically it doesn't work... am i missing something? it just uses the office_black theme no matter what...
Note: I'm using the trial version
0
CJ chavez
Top achievements
Rank 1
answered on 27 May 2010, 06:51 PM
let me tell you what my goal is:

I'm asked to be able to create a theme that i could apply to the ribbon bar(or the whole silverlight app), that theme has to be in a .xaml file so it could be like a standard theme that could be used later on.

so what I was thinking of doing was using any of your themes, modify it's style, than copy the style to a resource dictionary file, then apply it when needed, if it is possible.

now if I can't even change the theme statically, i'm stuck...

please help...
0
CJ chavez
Top achievements
Rank 1
answered on 27 May 2010, 07:27 PM
also i opened a solution that someone else provided from this site, and tried adding a ribbonBar control with the summer theme, and it didn't change...


<UserControl x:Class="SilverlightApplication3.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:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
             xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" 
          
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="400" xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
    <UserControl.Resources> 
        <Style TargetType="TextBox" controls:StyleManager.BasedOn="Office_BlackTheme"
        </Style> 
         
    </UserControl.Resources>  
 
    <StackPanel x:Name="LayoutRoot" Background="White"
        
        <TextBox Text="SomeText"/> 
        <telerikRibbonBar:RadRibbonBar controls:StyleManager.Theme="Summer" Height="100" Name="radRibbonBar1" Width="398" /> 
    </StackPanel> 
</UserControl> 
 

0
Accepted
Yavor Georgiev
Telerik team
answered on 28 May 2010, 01:52 PM
Hi CJ chavez,

 If you want to create a new theme, you will have to package it in a separate assembly, as outlined here.

However, if you only want to style several elements, you can do so with XAML Styles, there's no need to create a whole custom theme and try to apply it with the telerik StyleManager.

We provide the source code of our themes in our RadControls for Silverlight package. You can find them in the Themes folder in your RadControls for Silverlight installation folder. They are a good place to start building custom themes.

Also, when setting themes in Silverlight, make sure you reference the relevant theme's assembly.

Please don't hesitate to contact us with any further inquiries.

Regards,
Yavor Georgiev
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.
0
CJ chavez
Top achievements
Rank 1
answered on 28 May 2010, 04:25 PM
ok so i was able to do it from the code behind... now I'm looking at creating my own theme, thanks for your help! :)
Tags
General Discussions
Asked by
CJ chavez
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
CJ chavez
Top achievements
Rank 1
Share this question
or