Setting theme from style

11 posts, 1 answers
  1. Alex
    Alex avatar
    5 posts
    Member since:
    Sep 2012

    Posted 26 Feb 2010 Link to this post

    Is there any way to set attached property "telerik:StyleManager.Theme" on MS textbox from style? I tried this way:

    <Style TargetType="TextBox"
            <Setter Property="telerik:StyleManager.Theme" Value="Office_Black"/> 
    </Style> 


    but it doesn't work.



  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 26 Feb 2010 Link to this post

    Hello Alex,

    Please find attached an example.

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

    Regards,
    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. DevCraft banner
  4. Alex
    Alex avatar
    5 posts
    Member since:
    Sep 2012

    Posted 26 Feb 2010 Link to this post

    Thank you for an example - It works well. But I can't get it worked on SL4 beta. I need to use it in implicit style (it's a new feature in SL4) in this manner:

    <UserControl x:Class="SilverlightProject.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="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
         
        <UserControl.Resources> 
            <Style TargetType="TextBox"   telerik:StyleManager.BasedOn="Office_BlackTheme"
            </Style> 
        </UserControl.Resources>    
      <Grid x:Name="LayoutRoot"
            <TextBox Text="TextBox" /> 
      </Grid> 
    </UserControl> 


    It seems that this feature doesn't work in beta. Can you confirm it?


  5. Answer
    Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 04 Mar 2010 Link to this post

    Hi Alex,

    Please find attached  a sample project that demonstrates the desired functionality.
    In it you can find the assemblies from the last internal build.

    All the best,
    Bobi
    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.
  6. Alex
    Alex avatar
    5 posts
    Member since:
    Sep 2012

    Posted 04 Mar 2010 Link to this post

    Thanks a lot, it works well now.
  7. royalblue
    royalblue avatar
    3 posts
    Member since:
    Aug 2007

    Posted 23 May 2010 Link to this post

    How can I do in Silverlight 4 ?

    This sample run on Silverlight 3 successfully but in Silverlight 4 don't run.

    (I use RadControls_for_Silverlight_4_2010_1_0422_TRIAL_hotfix  TRIAL dll's)
  8. Alex
    Alex avatar
    5 posts
    Member since:
    Sep 2012

    Posted 24 May 2010 Link to this post

    What do you mean? How does it "don't run"? I've checked last sample (silverlightapplication3-2.zip) again - it works well. It successfully compiles and runs. At runtime it implicitly use defined style - textbox border becomes orange when textbox in focus. I recompiled the project with 2010.1.422.1040 dlls.
  9. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 27 May 2010 Link to this post

    Hello Serdar YILMAZ,

    The solution works as expected with the RadControls_for_Silverlight_4_2010_1_0422_TRIAL_hotfix .dlls on our side.

    Please take a look at the attached project and let us know if it works for you or if you need more info.

    Greetings,
    Tina Stancheva
    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.
  10. Riia
    Riia avatar
    17 posts
    Member since:
    May 2008

    Posted 22 Dec 2010 Link to this post

    Hi,

    I would like to ask few questions related to setting theme from style.

    For some reason I wasn't able to use StyleManager:BasedOn but using following I was able to set style for RadGridView
    <Setter Property="telerik:StyleManager.Theme" Value="Windows7"/>
        
    In addition to that I would like to set some other properties from style but if I define for example BorderBrush and BorderThickness after setting theme they do not apply to the grid. Should I be able to set both theme and also other properties in the same style?

    Is there any documentation related to this?

    Best regards,
    Riia
  11. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 23 Dec 2010 Link to this post

    Hi Alex,

     
    Considering the theming mechanism you can use these styles but the changes will be applied against the default Office_Black theme. However if you need to change a style related to a specific theme you need to get the specific theme template and its resources and apply the changes on your own. 
    I believe that the following article "Modifying built-in Theme" would be helpful for you on that matter.

    Regards,
    Vanya Pavlova
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  12. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2009

    Posted 20 Mar 2013 Link to this post

    How would one achieve this for the WPF controls? The BasedOn property doesn't seem to exist for StyleManager in WPF.

    UPDATE: Nevermind I figured it out myself. Looks like another special case of a feature created to make up for deficits in Silverlight when compared to features of WPF. For those who might care this can be achieved simply in WPF by using the following syntax.

    <Style BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=telerik:RadComboBox}}" />
Back to Top
DevCraft banner