Urgent ! Themes at runtime

2 posts, 0 answers
  1. Chitra Krishnan
    Chitra Krishnan avatar
    16 posts
    Member since:
    Nov 2009

    Posted 20 Nov 2009 Link to this post

    Hi Team,

    Please let me know how to apply telerik themes at runtime.

    This is what iam doing:

    1. I added in the <UserControl.Resources> the below:

    <

     

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

     

     

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="resourcedic"

     

     

    xmlns:telerik="clr-namespace:Telerik.Windows.Controls">

     

     

     

    <ResourceDictionary.MergedDictionaries>

     

     

     

    <ResourceDictionary

     

     

    Source="/Telerik.Windows.Themes.Office_Blue;Component/Themes/Office/Blue/Docking.xaml" />

     

     

     

    <ResourceDictionary Source="/Telerik.Windows.Themes.Office_Blue;Component/Themes/Office/Blue/Button.xaml" />

     

     

     

    </ResourceDictionary.MergedDictionaries>

     

     

     

    </ResourceDictionary>

     

     

     

    </UserControl.Resources>

     


    2. In .cs file iam doing the below to apply the them to the canvas inside the raddocpane:

    ResourceDictionary dic = resourcedic;

    if (dic.MergedDictionaries.Count != 0)

    {

    Uri uri = dic.MergedDictionaries[0].Source;

    ImplicitStyleManager.SetResourceDictionaryUri(grdresult, uri);

    ImplicitStyleManager.SetApplyMode(grdresult, ImplicitStylesApplyMode.Auto);

    ImplicitStyleManager.Apply(grdresult);

     

    }


    But the themes are not applying.
    Please let me know the steps to go about

    Regards
    Chitra K


  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 20 Nov 2009 Link to this post

    Hi Chitra Krishnan,

    In order to apply  the themes at runtime you have to set

    telerik:StyleManager.Theme="{Binding SelectedValue, ElementName=Themes}"
    on all controls how you are using. In the snippet above, ElementName is the x:Name of the control used to change the themes. Have a look at the attached sample project and let us know if you have any additional questions.

    Regards,
    Dimitrina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top