I am currently developing a small WPF application.
I have noticed that, especially in Windows 11, the Button and Menu controls look noticeably dated. Win 11 brought rounding to all of these, but WPF seems to be using an older, more square, styling:
Typical rounded button in a Win11 application vs. the default look of the <Button/> control in WPF:
This also applies to the <Menu /> - if we take a look at a typical program's menu UI styling under Windows 11 vs. the style in my WPF application:
Why does WPF have these different styles? I have been reading around and there's lots of mention about adding a reference to Microsoft.Windows.Common-Controls in app.manifest but this doesn't seem to have made any difference to these controls in my case.
What's more confusing is that the actual WPF window itself has rounded corners, and the context menu for right clicking the title bar of this window is using the new style - it seems to be controls inside the window that are plagued with the older styles.
Any help/info would be much appreciated!
WPF is officialy dead. That's probably the reason it doesn't receive new features, like the new theme (and more than 60 fps, stereoscopic rendering or native DirectX 12 without a picture buffer to transfer to DirectX 11 in WPF). Those other apps are using the Windows API for GUI, so they don't need to be even recompiled to get the new design. WPF is drawing GUI on its own, so it would need a not-so-small update, which is not economical.
Related
With Windows 8 and Windows 10 out, the original set of WPF controls is beginning to look a little... dated. I'm looking for something else, something that fits a little better in the more modern UI designs.
I've looked at mahapps.metro and Modern UI, and those seem a little drastic to me. The TabControl is a perfect example -- I'm not fond of the unbounded blocks of text that both of those seem to use for tabs. I prefer a bounded box. On the other hand, in Windows 10 the default focused WPF window has a white background, while the unaltered WPF menu is has a gray background, which looks a little weird:
Does anyone know of any good toolkits for pre-styled WPF controls aside from the two I mentioned earlier? Or am I more likely to get what I'm looking for by mixing and matching -- a little mahapps.metro, a little default WPF, a little custom styling?
I'm not looking to reinvent the wheel here. I don't want to find myself endlessly writing new styles, templates, etc, and micromanaging the XAML. There's a lot of interesting code in my project, and writing hundreds of lines of XAML is not my idea of a good time. :)
If it matters (I don't think it will, but you never know), I'm using Caliburn.Micro for my MVVM framework.
Or am I more likely to get what I'm looking for by mixing and matching -- a little mahapps.metro, a little default WPF, a little custom styling?
Yes, probably. You won't likely find a toolkit that just make all built-in controls look exactly like you want :).
Another option may to be look into the Universal Windows Platform (UWP): https://learn.microsoft.com/en-us/windows/uwp/get-started/whats-a-uwp.
These are the new kind of apps that can run on any Windows 10 device including PC, tablet, phone, Xbox, HoloLens, Surface Hub and more. The controls have better support for touch and pen input and probably look more what you refer to as "modern".
WPF is still a great choice for developing traditional Windows desktop applications. And if you compare the look of the built-in controls to a classic desktop application like Visual Studio, they don't look that "out-dated". Different kind of applications serve different kind of needs and sometimes you want controls that are tailored for a user that always uses a keyboard and a mouse and sometimes you don't.
I'm developing a simple WPF application. I don't use any custom styling. So it looks native on Windows 7 and 10. But today I have noticed that the context menu looks odd on Windows 10:
In other applications like 7-Zip, context menus look native:
How can I apply the flat Window 10 style to my context menus without breaking the native look on Windows 7?
Clarification: My context menu has a 3D split line on the left hand and a border around the selction. In 7-Zip, Explorer and other applications, there are neither a 3D split line nor a border around selctions. I'm used that WPF applications looks unlike Java Swing as a nativ Windows application.
But today I have noticed that the context menu looks odd on Windows 10:
Odd or not, this is actually how the default WPF ContextMenu looks like on Windows 10.
How can I apply the flat Window 10 style to my context menus without breaking the native look on Windows 7?
You need to define this "flat Window 10 style" yourself. There is an example of how to create a custom ContextMenu style available on MSDN that should get you started: https://msdn.microsoft.com/en-us/library/ms744758%28v=vs.110%29.aspx. There is no quick fix.
You're getting hung up on the shortcut keys (>, Enter, Ctrl + PgDn, etc). Your application isn't assigning any, while 7-zip is assigning them. Or maybe, the outlining. Don't get thrown off. Things are working exactly as they should.
But let's not overlook the fact that if 7-zip is not written in WPF, you can't expect the same results.
I'm working in a WinForms project.
I have a dark theme activated in Windows and this is a default combobox when it's focused:
And this is when it has no focus:
An horrible and insane white border appears when the control lost focus, I want to avoid that without disabling XP Styles in the project.
I know that maybe the only way is inheriting the control to make my own, the problem is I don't know what I need to do with the control, maybe changing a setstyle property or I don't know.
I think you're trying to solve a problem that isn't in the scope of your application. Isn't this just an issue with the theme in question you are using?
Windows has many themes. The major themes still supported are Classic (pre-XP), Luna (XP), Aero (Vista/Win7), and Modern (Windows 8). All of these can be customized to create an infinite number of possible scenarios.
Most Windows Forms controls are based on Win32 controls which are drawn by the OS according to these system themes.
So you have to understand that on the machine you're testing on what you're seeing is going to vary a lot from what users of the application will see on different versions of Windows with different user preferences.
The simple fact is that if you use WinForms base controls you really should surrender control of the appearance to the OS as much as possible.
It's also widely accepted to create your own application theme that the user can't change or that they have to pick from a predetermined set of themes you have created. Examples of this include Google Chrome, iTunes, Winamp, etc. It is typically an awful lot of work to do this with simple Win32 controls unless you use something like WPF which makes it easier.
The important thing is that you can't really pick and choose which parts of your application to theme. If you want it to look consistent you either take responsibility for the entire theme yourself or follow the Windows standards of using system resource colors such as ControlText, ActiveBorder, AppWorkspace, etc.
is there any way that winforms or WPF can do this kind of UI? transparent with blur window.
A forenote: Windows 8 removes the Aero Glass effect. Windows will appear with a solid background where there would be glass (like how they appear on Windows 7 when you disable the glass effect but still run the DWM).
That said, the effect is done using Win32's DwmExtendFrameIntoClientArea function. Using this in your program differs depending on whether you're using WPF or WinForms (as WPF windows do some pretty interesting window subclassing, and of course, WPF controls are largely windowless).
To get a "whole glass" window, you just use the DwmExtendFrameIntoClientArea function to fill your window, rather than just the first 50px or so, which is what IE and other browsers do.
This is the canonical MSDN article on how to do this with WPF: http://msdn.microsoft.com/en-us/library/ms748975.aspx
For WinForms, see this blog article: http://blogs.msdn.com/b/tims/archive/2006/04/18/578637.aspx
Enjoy, but not for long considering Windows 8...
My question is the same as the one at Changing the background color of a DateTimePicker in .NET. Unfortunately, the solution there doesn't work in Windows Vista/7 when visual styles are enabled. It does work fine if I disable visual styles, but that isn't an acceptable solution for my application.
How do I change the background color of a .NET WinForms DateTimePicker under Windows Vista / 7 when visual styles are enabled?
Any answers written from a C++ / Windows API perspective are welcome as well; I am experienced enough to translate a solution from one platform to another. I just ask it from a C# / WinForms perspective as there are a lot of developers who use it.
Edit: Also I should add that suggestions to owner-draw the entire control are at the very bottom of my possible list of solutions as it sounds like a ton of work. Existing efforts I've seen seem very incomplete.