Style of VS Controls

8 posts, 0 answers
  1. Frank
    Frank avatar
    7 posts
    Member since:
    Aug 2010

    Posted 24 Sep 2010 Link to this post

    Hi,

    i am using the Summer Theme. It works fine with all Telerik Controls, but not for the Controls which are included in VS (RadioButton, CheckBox,..) These controls still have the default windows style.

    This is the way I implemented the Theme.

            public App()
            {
                this.Startup += this.Application_Startup;
                this.Exit += this.Application_Exit;
                this.UnhandledException += this.Application_UnhandledException;

                StyleManager.ApplicationTheme = new SummerTheme();

                InitializeComponent();
            } In my App.xaml I add some Images and customized styles.
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="/Ama.Styles;component/Colors.xaml" />
                    <ResourceDictionary Source="/Ama.Styles;component/SpecificStyles.xaml" />
                    <ResourceDictionary Source="/Ama.Images;component/Images.xaml" />
                    <ResourceDictionary Source="/AddressManager.Images;component/Images.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Application.Resources>

    Thanks for help!
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 24 Sep 2010 Link to this post

    Hi Frank,

    For any non-telerik controls you need to explicitly set the StyleManager.Theme attached property:
    telerik:StyleManager.Theme="Summer"

    I have attached a sample project.

    Kind regards,
    Veselin Vasilev
    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. Frank
    Frank avatar
    7 posts
    Member since:
    Aug 2010

    Posted 24 Sep 2010 Link to this post

    Hi Veselin,

    thank you for your email and the example.
    Is a application-wide setting not possible?

    Thank you!
  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 27 Sep 2010 Link to this post

    Hi Frank,

    Yes, this is possible. You can define the following styles in the app.xaml page:

    <Application.Resources>
        <Style TargetType="RadioButton">
            <Setter Property="telerik:StyleManager.Theme" Value="Summer" />
        </Style>
        <Style TargetType="CheckBox">
            <Setter Property="telerik:StyleManager.Theme" Value="Summer" />
        </Style>
        <Style TargetType="Button">
            <Setter Property="telerik:StyleManager.Theme" Value="Summer" />
        </Style>
    </Application.Resources>

    Thus you do not have to set this property to each control separately.

    All the best,
    Veselin Vasilev
    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
  5. Kwinten Volckaert
    Kwinten Volckaert avatar
    6 posts
    Member since:
    Mar 2005

    Posted 30 Jan 2011 Link to this post

    Veselin, this last way make my visual studio crash from the moment I try to apply this to a listbox.
    Also this code 
    StyleManager.ApplicationTheme = new SummerTheme();

    doesn't work on a radribbon...is there a way to make this control also themed over the application?
  6. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 02 Feb 2011 Link to this post

    Hello Kwinten Volckaert,

    This is very strange. I suggest that you open a support ticket and attach a sample application there.
    We need to reproduce the issue and debug it locally.

    Thank you

    Regards,
    Veselin Vasilev
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  7. Tomas
    Tomas avatar
    92 posts
    Member since:
    Jun 2010

    Posted 23 Mar 2011 Link to this post

    Hi,

    I'm having trouble getting this to work as well I've defined the style like this:
    <UserControl.Resources>
            <Style TargetType="TextBox">
                <Setter Property="telerik:StyleManager.Theme"
                        Value="Office_Silver" />
            </Style>
    ...

    But when I run my program I get the following exception:
    An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.dll
    I'm using 2011 SP1 version.

    Any ideas?

    Tomas
  8. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 24 Mar 2011 Link to this post

    Hi Tomas,

     
    In Silverlight environment the recommended approach to set any of our Themes using an implicit style follows this pattern:

    <UserControl.Resources>
        <Style TargetType="TextBox" telerik:StyleManager.BasedOn="Office_Silver">
            //The rest of your Style
         </Style>
        </UserControl.Resources>
        <Grid x:Name="LayoutRoot" Background="White">
            <TextBox Margin="184,112,160,168" TextWrapping="Wrap" Text="TextBox"/>
        </Grid>
    </UserControl>


    The code you have used is an apporpiate solution in WPF, not in Silverlight.



    All the best,
    Vanya Pavlova
    the Telerik team
Back to Top