XAML theme file name for Windows 10 RRS feed

  • Question

  • I want to provide platform-specific themes for my user control in WPF. There are already files Classic.xaml, Luna.NormalColor.xaml, Aero.NormalColor.xaml and Aero2.NormalColor.xaml in the Themes directory of the project. As far as I know these are for Windows 2000, XP, 7 and 8 respectively.

    What is the correct file name for Windows 10? It does look considerably different from Windows 8 and I need consistency with the rest of the GUI.

    If the WPF theme names can't support this distinction, how would I solve this issue in code?

    Friday, December 2, 2016 10:47 PM

All replies

  • You can force your WPF application to use a specific theme by adding the corresponding theme's resource dictionary to your App.xaml file:

    <Application x:Class="WpfApplication1.App" xmlns="" 
                 d1p1:Ignorable="d" xmlns:d1p1="">
                    <ResourceDictionary Source="/PresentationFramework.Luna, Version=,
     Culture=neutral, PublicKeyToken=31bf3856ad364e35,
     ProcessorArchitecture=MSIL;component/themes/luna.normalcolor.xaml" />

    Don't forget to add a reference to the corresponding assembly (Project->Add Reference->Assemblies->Framework in Visual Studio), for example PresentationFramework.Luna.dll in this case.

    The default control styles do look different on different versions on Windows:

    Windows 10 uses the styles defined in PresentationFramework.Aero2.dll by default.

    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    Sunday, December 4, 2016 12:12 PM
  • Windows 10 uses the styles defined in PresentationFramework.Aero2.dll by default.

    Now that's a big problem. Aero2 is already used for Windows 8. And Windows 10 looks completely different.

    So the only option I see now is dropping theme support of my control library for Windows 8 in favour of Windows 10. Whoever designed this doesn't know a lot about their own technologies. WPF seems unwanted on Windows 10. WPF doesn't seem very alive anymore at all.

    Can I control the theme selection behaviour through my own code anyhow? Say I have the files Aero.NormalColor.xaml for Windows 7, Aero2.NormalColor.xaml for Windows 8 and my own made-up name Windows10.xaml for Windows 10, and then pick the latter one if I find the environment is Windows 10?

    PS: The trouble comes from the [PresentationFramework]MS.Win32.UxThemeWrapper.EnsureThemeName method in the WPF source code. It uses the artificial name "Aero2" instead of the system-provided "Aero" for Windows 8 or newer but fails to check for Windows 10. WPF just wasn't updated for Windows 10, so it might be abandoned. Not something we should start using today.

    • Edited by ygoe Monday, March 20, 2017 2:56 PM
    Monday, March 20, 2017 1:50 PM