locked
What is the theme name for a WPF application on Windows 8? RRS feed

  • Question

  • Does anyone know the theme name to use for our theme-level dictionarys on Windows 8?

    For example, I have the following files which define resources particular to my controls' visuals:

    Aero.NormalColor.xaml

    Classic.xaml

    Luna.*.xaml (3 variations)

    Royale.NormalColor.xaml

    Generic.xaml

    On Windows 8, Generic.xaml is selected but I'd like to customize the look and this page hasn't been updated with the new name:

    http://msdn.microsoft.com/EN-US/library/aa970773(v=VS.110,d=hv.2).aspx

    Thursday, August 30, 2012 5:30 PM

Answers

  • I have dug deeper into .NET 4.5 files on Windows 8 and found the answer so I'm sharing that here for future visitors.

    If you want to customize the look of controls on Windows 8 within your WPF application, the theme file should be named: Aero2.NormalColor.xaml

    I added one of these to my solution in the \Themes folder and the resources are used when my

    application is launched on Windows 8. Put your Metro-looking resources here!

    If you do not do this, WPF will be loading resources from Generic.xaml which is probably not what you want.

    John Schroedl

    • Marked as answer by jschroedl Friday, August 31, 2012 1:37 PM
    Friday, August 31, 2012 1:37 PM

All replies

  • Hi jschroedl,

    Windows8 does not change the default theme, it will use Aero theme, same as Windows7.

    you could cretae your theme, and apply it:

    <Application.Resources>
            <ResourceDictionary Source="MyTheme.xaml"/>
    </Application.Resources>

    As for your concern:

    -->On Windows 8, Generic.xaml is selected but I'd like to customize the look and this page hasn't been updated with the new name:

    If you want to custom it, you could change the Generic.xaml file, you could refer to below link to know wpf how to create custom theme: 

    http://wpf.codeplex.com/wikipage?title=WPF%20Themes

    best regards,


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, August 31, 2012 7:15 AM
  • Thanks for your reply Sheldon.

    However, my experience does not match what you state. I have created a super-simple sample project to confirm this. I see that on Windows 7, Aero.NormalColor.xaml resources are used but on Windows 8, Generic.xaml resources are used.

    So this is either a WPF bug or we need another .xaml file name to use.

    For your point about explicitly loading the theme, I don't wish to explicitly load a theme. Rather, I'd prefer to create theme-specific resources and allow WPF to automatically load the proper theme file for me. That's why I need to know the .xaml file to put them into...

    John

    Friday, August 31, 2012 1:15 PM
  • I have dug deeper into .NET 4.5 files on Windows 8 and found the answer so I'm sharing that here for future visitors.

    If you want to customize the look of controls on Windows 8 within your WPF application, the theme file should be named: Aero2.NormalColor.xaml

    I added one of these to my solution in the \Themes folder and the resources are used when my

    application is launched on Windows 8. Put your Metro-looking resources here!

    If you do not do this, WPF will be loading resources from Generic.xaml which is probably not what you want.

    John Schroedl

    • Marked as answer by jschroedl Friday, August 31, 2012 1:37 PM
    Friday, August 31, 2012 1:37 PM
  • Hi John,

    you're totally right.

    In .NET 4.0 we had the following theme-specific assemblies:

    PresentationFramework.Aero.dll - containing Aero.NormalColor.xaml

    PresentationFramework.Luna.dll - containing Luna.NormalColor.xaml, Luna.Homestead.xaml and Luna.Metallic.xaml

    PresentationFramework.Classic.dll - containing Classic.Xaml

    PresentationFramework.Royale.dll - containing Royale.NormalColor.Xaml

    In .NET 4.5 Microsoft has introduced two additional Assemblies:

    PresentationFramework.AeroLite.dll - containing AeroLite.NormalColor.xaml

    PresentationFramework.Aero2.dll - containging Aero2.NormalColor.xaml

    If you develop a new control and you want to support themes, the Approach described by Sheldon of course won't work. Instead you create your theme-Folder containing the generic.xaml as a fallback and then different XAML-Files for specific Windows-themes. For Windows 8, use the Aero2.NormalColor.xaml. It is automatically used when the control is used in Windows 8.

    I don't know what the AeroLite.NormalColor.xaml is for. It's not automatically used if your app runs in Windows 8. Maybe a Microsoft-internal can say something about this. I've checked it with a Button, seems it has exactly the same Style/Template as the Aero2.NormalColor.xaml.


    Thomas Claudius Huber - http://www.thomasclaudiushuber.com

    Wednesday, September 5, 2012 11:33 AM
  • "I don't know what the AeroLite.NormalColor.xaml is for. It's not automatically used if your app runs in Windows 8."

    I've seen some screenshots which appear to indicate that it is used by Windows Server 2012. You can enable it on Win8 by editing a .theme file to select AeroLite.msstyles instead of Aero.msstyles.

    Scrollbars, ComboxBoxes, ListViews are a bit different. In "good" WPF tradition one control looks like crap: TabControl has gray border that's too thick and shouldn't be there anyway.

    Wednesday, September 5, 2012 12:07 PM
  • Thanks to Mike Danes' response here:

    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d05228d4-3dc2-4241-84a1-236a7a1f2d65

    I've gotten my Aero2 styling working on Win8.

    I too saw the AeroLite but wasn't able to trigger it. Mike's suggestion of modifying a .theme file is interesting or maybe I'll install Windows Server 2012 in a VM to try it.

    John

    Wednesday, September 5, 2012 12:16 PM
  • Haha. You're right, it wouldn't be a WPF theme without at least one crappy control.
    Wednesday, September 5, 2012 12:17 PM
  • I tried using the latest Aero2.NormalColor.xaml file from Blend 2013, but the styles (especially for Buttons) still look really bad and not like Windows 8. How can I make a WPF app being styled properly when running on Windows 8?
    Thursday, December 4, 2014 3:40 PM