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

Change style in application

10 Answers 124 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 23 Jul 2010, 02:01 PM
Hi!
I'm new here, and I just wanted to know how to change the "style" of a WPF application(e.g. for windows7, office_blue, ...?) like in demo? I don't need it at runtime.

I've VS2010 with the telerik rad controls for wpf installed(not the trial)

Thank you!

10 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 24 Jul 2010, 01:26 PM
Hi Julien,

This should get you started. Let us know if there are any problems.

All the best,
Ross
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
Julien
Top achievements
Rank 1
answered on 26 Jul 2010, 10:44 AM
But is there a way to do it application wide in the xaml file?Because I see only instance specific for xaml.

Thanky you
0
Rossen Hristov
Telerik team
answered on 26 Jul 2010, 01:13 PM
Hello Julien,

You can set it like this:

using System.Windows;
using Telerik.Windows.Controls;
 
namespace FilteringControlStyle
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
             base.OnStartup(e);
             StyleManager.ApplicationTheme = new VistaTheme();
        }
    }
}

I hope this helps.

Regards,
Ross
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
Julien
Top achievements
Rank 1
answered on 26 Jul 2010, 01:40 PM
Okay, so no way to put this in Xaml file?
0
Rossen Hristov
Telerik team
answered on 28 Jul 2010, 09:36 AM
Hello Julien,

There is no way. You can set instance-specific built-in theme in XAML, but not the ApplicationTheme. Where would you put it?

Regards,
Ross
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
Julien
Top achievements
Rank 1
answered on 29 Jul 2010, 06:33 AM
Why not as a property of the Application element?

Because doing thing like that doesn't permit to visualize how is the application during the dev.
0
Rossen Hristov
Telerik team
answered on 29 Jul 2010, 09:42 AM
Hello Julien,

You can not do that. Try it and see what the XAML parser will tell you.

All the best,
Ross
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
Daniel Schilling
Top achievements
Rank 1
answered on 30 Jul 2010, 11:23 AM
Hi,

Julien wrote:
"Because doing thing like that doesn't permit to visualize how is the application during the dev. "

This is also important for me, especially for "blendability". We develop with MVVM and a team of developers and designers. Our designer complains about this: he doesn't see his result in Expression Blend 4, because Blend doesn't evaluate app.xaml.cs. So he can't get his job done - styles and templates must be declared more than once and a "theme" must be reinvented via styles and templates.

Is there a "blendable" way of declaring an application-wide theme?

Thanks,
Daniel

0
Julien
Top achievements
Rank 1
answered on 30 Jul 2010, 02:01 PM
And actually it seems it doesn't work because I instantiate my Windows on application code behind:

public App():base()
{
   MainWindow windows = new MainWindow();
   LoadFlowManager(windows);//Custom method to manage some usercomponent flow
   this.Run(windows);
}
0
Miroslav
Telerik team
answered on 05 Aug 2010, 11:23 AM
Hello Daniel Schilling,

Unfortunately there is no easy way to see the runtime theme in design-time. 

One way will be to have the theme's xaml in your application resources or assigning styles as a local value. This may not be easy to maintain though.

Sincerely yours,
Miroslav
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
Tags
General Discussions
Asked by
Julien
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Julien
Top achievements
Rank 1
Daniel Schilling
Top achievements
Rank 1
Miroslav
Telerik team
Share this question
or