Authentic Windows 7 Theme in Windows 10? - wpf

I develop a WPF desktop application that runs in a Citrix environment which applies the Windows 7 Basic Theme to my application. As a result, I run Windows 7 on my dev workstation to make sure the UI renders as intended.
I would like to upgrade it to Windows 10, however, but I have to find means of running my app with the Windows 7 theme within Windows 10. Incidentally (and oddly), if I run my app in Windows XP compatibility mode on Windows 10, it renders with the Windows 7 theme, so surely the OS is able to render the theme. I'm not sure I want to do all the testing of my app with compatibility mode activated, though...
I am also aware of 3rd party theming solutions, but to rule out any discrepancies, I would like to use the authentic Windows 7 theme from Microsoft.
Are there any tricks/tweaks/hacks out there to simply enable the Windows 7 theme for my app in Windows 10?

The WPF Theme for Aero is located in the PresentationFramework.Aero library, so add that as a reference. Then, in your App.xaml add the following merged dictionary to override the default theme.
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml" />
</ResourceDictionary.MergedDictionaries>
I'm pleasantly surprised that they've finally updated WPF in .NET 4.5 to support Windows 8/10 themeing (they didn't at the start of Windows 8) with the following:
PresentationFramework.Aero2
PresentationFramework.AeroLite
Haven't seen it before today, need to work with .NET 4.5 more often ;)

Try making the form an MDI with child windows as MDI Childs use the Windows 7 style as their border, or add some references to PresentationFramework.Aero/AeroLite/Aero2 and apply it in your code

Related

XAML vs WPF vs Store App vs Phone App vs UWA

I know that XAML is used for designing UI in combination with Blend. I am confused with so many terms, like, how XAML comes into play for WPF, Store App, Phone App or UWA. Morever, what is the difference between WPF, Store App, Phone App and UWA. Does all that means that old Desktop Project will no longer be used and replace by either WPF or Store App or UWA?
When .NET was released in ~2000, you could use WinForms to make desktop applications for Windows. It provides access to 'native' controls (i.e. A Button made in WinForms actually is a Windows Button control from user32.dll) by wrapping the Windows API in managed code. These can run in any version of Windows which has the appropriate .NET framework version installed, including upto Windows 10.
In 2006, WPF was released which is an alternative to WinForms. WPF uses XAML, which is a language based on XML, to declare the user interface elements. In a simple WPF app, the .xaml file describes the GUI and the code-behind file describes the logic. DirectX is used to draw whatever is described in the .xaml into the window.
Like Winforms, programs made using WPF can run in any version of Windows which has the appropriate .NET framework version installed, including upto Windows 10. Note that using XAML is completely optional. Whatever user interface elements you describe using XAML can also be made using your .NET language C# or VisualBasic.NET. But using XAML is usually simpler. See To XAML or not to XAML (MSDN Blogs).
From XAML (Wikipedia) :
As XAML is simply based on XML, developers and designers are able to share and edit content freely amongst themselves without requiring compilation.
From ~2012 along with Windows 8, a new kind of app called metro/modern/windows-8/windows-store-apps can be made. These apps are similar to WPF in that they use XAML for describing the GUI. These apps can run only in Windows 8, 8.1 and Windows 10. Windows 8.1 added some improvements and features but remained mostly the same. The same technology was used to make apps for Windows Phone.
With the release of Windows 10, Microsoft made UWP (Universal Windows Platform) through which you can use the same code base to target differnt kinds of devices (desktop/mobile/xbox/IoT/holographic). These apps made for the UWP are similar to the earlier Windows 8/8.1 apps. Like before, XAML is used to describe the GUI.
Only for the Windows Store apps, there is no backward compatibility. The timeline goes Windows 8 -> Windows 8.1 -> Windows 10/UWP. An app made in UWP can only run in Windows 10 and an app made in Windows 8.1 can not run in Windows 8.
I would highly recommend referring to this discussion thread in stopbyte, it has far more details and explanation of the concepts behind WPF, UWP And WinRT.
As for WinForms, from my experience it's history now. Have been almost replaced by WPF (though it still has mainstream support as mention by #Jazimov).
I'v noticed that Microsoft has stopped improving Windows Forms and probably has stopped maintaining it as well.

WPF Ribbon changes title bar style in XP

[EDITED]
After several tries, I found out it was the Microsoft WPF Ribbon that causes the title bar style not rendering correctly.
Application without Ribbon in XP:
Application with Ribbon in XP:
I have already set the theme to be XP style. Still not fix. It is a bug in Microsoft Ribbon or am I missing something? On Window 7, on the other hand, renders OK.
Develop on WPF C# .NET 4, VS2010.
Why do you care? this is a user setting to have Aero enabled or not in Vista or 7 and theming enabled or not in XP like in 2 and 3 pictures you sent.
In general you should ignore this. Office 2007 and 2010 with ribbon UI renders the same but because ribbons are skinning the application windows completely.
My suggestion is to either use skins and do the same or simply ignote this because if I use Vista with Aero enabled I would not like your App to look like classic Win2000 applications.
This is anyways an issue with the window title bar as it will use the default theme of the OS you are using.
I suggest you to neutralize the style by implementing a custom window style that takes the windows 7 look n feel for all windows ion your applications. Have a look at the MessageBox control from latest extended WPF toolkit.
It has a windows 7 style themse that looks exactly same on all the above OS if you use
Window.AllowsTransparency="False"
Window.WindowStyle="None"
Window.Style="{StaticResource Windows7WindowStyle}"

Winforms control spacing in Windows 7

We have an in-house .net 2.0 winforms app currently developed on Visual Studio 2005 in Windows XP. Everyone in the office until now is running Windows XP, and there are no issues.
We recently ordered a new computer with Windows 7 for one of our managers we were hoping to use, and the app installs fine. The issue is the spacing around every label, textbox, and button - making some forms not fit.
Is there some setting that we can use to make Windows 7 display each control where it is placed in our XP development environment and like the rest of our XP clients show?
Ugh, what kind of idiot management team gives a new machine to a manager instead of a programmer?
Control Panel + Display, Advanced tab, change the DPI setting to repro the problem on your XP machine. Read the docs for the Form.AutoScaleMode to find out what's going on.

Windows 7 Aero theme

I've already check stackoverflow and the web for my problem, but I can't find any answer.
I can't find a way to have the Windows 7 Aero theme working. I mean, I have the Aero style from PresentationFramework.Aero, but it has the Vista look, the blue selection is not exactly the same.
This is the Windows 7 theme in Windows Explorer
And this is mine (the Aero look, I got by follow this thread)
I Have already managed to do the same ,as windows 7, by hand, but it's a pain to have to style every control, in order to retrieve this effect. Do you know if there is any way to get the Windows 7 Aero?
There is no way to achieve this out-of-the-box. The default WPF List- and TreeView controls are extremely lacking in functionality (compared to the native counterparts) and the whole WPF Aero theme is severely missing polish. It wasn't updated for Windows 7 (which Aero-variant looks also better than Vista), and it doesn't even look like Vista. Apparently many people are satisfied with a half-assed copycat theme (also judging by lots of fake-looking Windows styles in UI toolkits).

WPF Application have Win2000 style, but I'm using Win XP

Why does my application have the Windows 2000 style? I have the normal Windows XP - Style but the buttons and all the other controlls look like in Windows 2000.
By default, WPF will use your system's current theme, i.e., if you are on Windows 7, then the Aero theme will be the default. The same will occur with Vista and XP themes. When WPF is unable to detect your theme, WPF will fall-back to the default "Classic" theme.
If you are seeing the Classic win2k theme, then a likely cause is you have modified your system's theme with something like the Zune theme or some other custom theme.

Resources