Stopbyte

Why Microsoft.Windows.Themes doesn't Work on Windows 7 and works in Windows 10?

I made a simple WPF application which requires using Microsoft.Windows.Themes namespace in PresentationFramework.Aero2 assembly in Windows 10 using Visual Studio 2015.

and it works completely fine, but when i tried to build the visual Studio project in Windows 7 using same Visual Studio version (2015) it didn’t work, all assemblies seem there and i don’t use any external ones at all. but somehow it won’t compile, i made sure that i use same .NET framework 4.6. but somehow the Compiler can’t find types within the Microsoft.Windows.Themes Namespace, i am not sure if it’s a bug in .NET or something.

i am using that namespace in my App.xaml file like this:

<Application
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
             x:Class="App1.App"
             StartupUri="MainWindow.xaml">

Can anyone help me solve this please.

2 Likes

Use "PresentationFramework.Aero" instead of "PresentationFramework.Aero2" in order to work in both Windows 7 and Windows 10.

1 Like

"PresentationFramework.Aero2" Is not working correctly on Windows 7, It is NOT backward compatible. Instead, use PresentationFramework.Aero, Which is supported by Windows XP upwards.

PresentationFramework.Aero2 Is only supported in Windows 8+, Of course, there is a bit of difference between the two Aero and Aero2. Aero2 has a bit more features concerning the Window Chrome. But Aero will work just fine for you.

Thus, you should be doing this instead:

<Application
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
             x:Class="App1.App"
             StartupUri="MainWindow.xaml">
2 Likes