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

Style of VS Controls

7 Answers 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 24 Sep 2010, 03:50 PM
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!

7 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 24 Sep 2010, 04:26 PM
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
0
Frank
Top achievements
Rank 1
answered on 24 Sep 2010, 07:33 PM
Hi Veselin,

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

Thank you!
0
Veselin Vasilev
Telerik team
answered on 27 Sep 2010, 07:40 AM
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
0
Kwinten Volckaert
Top achievements
Rank 1
answered on 30 Jan 2011, 06:24 PM
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?
0
Veselin Vasilev
Telerik team
answered on 02 Feb 2011, 05:02 PM
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>>
0
Tomas
Top achievements
Rank 1
answered on 23 Mar 2011, 03:50 PM
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
0
Vanya Pavlova
Telerik team
answered on 24 Mar 2011, 01:06 PM
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
Tags
General Discussions
Asked by
Frank
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Frank
Top achievements
Rank 1
Kwinten Volckaert
Top achievements
Rank 1
Tomas
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or