dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.07k stars 1.17k forks source link

Use accent color as the default color for controls #3775

Open JaiganeshKumaran opened 3 years ago

JaiganeshKumaran commented 3 years ago

Related to https://github.com/microsoft/ProjectReunion/issues/232

Today WPF uses Blue as the default colour instead of the user's accent colour. This is the same for WinForms too but since it's GDI based it can be tweaked easily but WPF controls are rendered independently so it needs internal modification for WPF. Please start using the accent colour on Windows 10 for a consistent user experience.

miloush commented 3 years ago

Do you mean for hyperlinks?

Like WinForms, WPF uses the system color setting (i.e. COLOR_HOTLIGHT via SystemColors.HotTrackBrushKey) for hyperlinks, unless, for some reason, they are in a RichTextBox.

I agree that the accent color (and brush and corresponding dynamic keys) should be available through SystemColors regardless of any theming.

However, unless your app is using the whole system theme then it does not make any sense to take out the hyperlink color (e.g. white) and apply it to an app that has different colors (e.g. white background).

For full Windows 10 WPF theme that would presumably use the accent colour for hyperlinks and elsewhere as appropriate, see #1485.

JaiganeshKumaran commented 3 years ago

@miloush For everything like list view selection, button click, borders just like WinUI. The problem is these methods return GDI theming and new Windows Runtime theming. You can use Windows.UI.ViewManagement.UISettings.GetColorValue() to get the modern colours defined in Settings personalization.

miloush commented 3 years ago

You said WPF uses Blue, but unless I missed something, that is not true for list view selection, button click and borders.

Looks like you are looking for full theme then, in which case this would be duplicate of #1485.

JaiganeshKumaran commented 3 years ago

@miloush No, I'm looking for the colour. It doesn't follow the modern Windows colour set in Settings and instead uses the old colour palette which is hidden in Windows 10.

mdtauk commented 3 years ago

It would be nice if in the future as well as updating the WPF control themes to better match WinUI and FluentUI - that through some new Reunion API, the Accent Color, Light and Dark theme resources could apply to WPF. Including redrawing the windows as the theme updates.

JaiganeshKumaran commented 3 years ago

@mdtauk That can be done but I want WPF to follow modern system colours. It is not a WinUI only thing and can be accessed in any application and with Windows.UI.ViewManagement.UISettings.GetColorValue()

miloush commented 3 years ago

@Jaiganeshkumaran In WPF, colours for controls are supplied by themes that contain control styles. The issue I referenced already expressed the team's intent to provide what you are asking for. If you disagree, explain how your request is different.

JaiganeshKumaran commented 3 years ago

@miloush I disagree because #1485 is telling about inline style with Winforms which also uses the old colour scheme instead of WinRT accent. This is about adopting the new colour scheme set in Settings app

mdtauk commented 3 years ago

@Jaiganeshkumaran In WPF, colours for controls are supplied by themes that contain control styles. The issue I referenced already expressed the team's intent to provide what you are asking for. If you disagree, explain how your request is different.

There is a difference between the System Colors which are provided by the Win32 APIs and MSStyles

image

And the Modern WinUI colour resources provided by the Light and Dark modes, and the user's chosen Accent Color.

image

JaiganeshKumaran commented 3 years ago

@mdtauk Actually the modern colours are not actually part of WinUI. They are stored separately but Windows.UI.ViewManagement.UISettings.GetColorValue() can be called in non WinUI apps as well.

miloush commented 3 years ago

I am aware of the difference. https://github.com/dotnet/wpf/issues/1485#issuecomment-686392065 specifically says, requoting

The WinUI team, which now owns WPF, said in the July Community Call that they plan to update the WPF styles for Fluent Design.

How is this different from what is being asked here?

JaiganeshKumaran commented 3 years ago

I didn't ask for styles only the colour but that can be part of it. However many so-called "Fluent" apps like Microsoft Edge don't follow the same colour scheme so I will keep it open.

miloush commented 3 years ago

The color is defined in styles. I am obviously failing to get the point across so I will leave it for others to try.

mdtauk commented 3 years ago

I didn't ask for styles only the color but that can be part of it. However many so called "Fluent" apps like MS edge don't follow the same color scheme so I will keep it open.

Edge is not WPF nor WinUI.

Fluent Design would require a new Default Theme for WPF (styled to match WinUI and FluentUI control templates and theme colours) as well as Light and Dark mode support, as well as High Contrast themes.

It would also require a WPF API that can use and apply the user's chosen Accent Color.

Of course this would only apply to the control templates when the WPF app is running on a supported Windows 10 version.

JaiganeshKumaran commented 3 years ago

@mdtauk As a user, when I change the colour from Windows Settings, I expect that all native apps follow it. A user doesn't know the difference between UWP XAML and WPF XAML and non-XAML UI. Third-party apps that synchronise the accent colour from desktop to modern exists but why can't Microsoft do that with Windows? Since WPF is open-source I just asked to follow my accent colour and not use the old stuff.

JaiganeshKumaran commented 3 years ago

@miloush Those values don't use the modern colouring system instead using the GDI colour which has no customization UI anymore to push apps to UWP.

mdtauk commented 3 years ago

@mdtauk As a user, when I change the colour from Windows Settings, I expect that all native apps follow it. A user doesn't know the difference between UWP XAML and WPF XAML and non-XAML UI. Third-party apps that synchronise the accent colour from desktop to modern exists but why can't Microsoft do that with Windows? Since WPF is open-source I just asked to follow my accent color and not use the old stuff.

I hear ya, I am asking for changes to the default system theme for WPF apps on Windows 10.

ShankarBUS commented 3 years ago

Guys, don't get me wrong but WPF is put to maintenance mode.

No new controls or features.

They won't be listening to us. Even WinForms had some striking changes after being opensourced. But WPF?

They don't want to invest in WPF anymore. Our only options are either switch to WinUI or use 3rd libs.

You are wasting your time and energy arguing with them. I lost my hope that WPF will be actively improved once it's open source.

Even I and another guy proposed some features such as hard edge gaussian blur and smooth scrolling as in UWP. They didn't even respond!

You thing they would do high workload tasks like this?

This would require heavy work, testing and synchronization with WinUI team. Which they won't do.

That's it folks, continue your conversation!

JaiganeshKumaran commented 3 years ago

@ShankarBUS I don't develop WPF apps any more so I don't care if it's maintained or not but WPF apps on Windows 10 must follow things like the accent colour, dark mode etc... to make Windows consistent.

ShankarBUS commented 3 years ago

Did you even read my comment fully?

They don't care about adding new features to WPF!!!! (Or WPF in general)

It's left to die silently!

They will just ignore this issue and move this to their backlog! I saw past WinUI community calls, the team would just go by the roadmap they planned.

This issue will be one of the other backlogged issue 😢.

to make Windows consistent.

It's up to the developer! If dev don't care why would MS?

They provide the tools elsewhere, stop asking them everything!

There are community driven projects that do their job.

As a WPF dev, I use a 3rd party lib (open source - ModernWpf) to make my app (ModernFlyouts) consistent with Windows!

Any developer can do it iff they have the intent!

TL;DR

"WPF is dead, move on to WinUI" This is what MS thinks. So no new features!

JaiganeshKumaran commented 3 years ago

@ShankarBUS Remember Visual Studio is still WPF and not WinUI. It's not an active technology but many applications still rely on WPF.

ShankarBUS commented 3 years ago

So, let's even if they "add" this feature to WPF.

It would only be available on newer .NET releases post .NET 5.

So the app developer still need to migrate their app to the "newer" .NET.

The WPF team would make a half-ass implementation of the "new" theme support, styles.

It would be so fragmented!

It just takes like <1 hr to switch to third party libs (such as MahApps or ModernWpf) to get a full proper WinUI like app!

(I'm not advocating for any of the mentioned libraries, just stating the obvious)

It's the developer's mistake not keeping their app consistent with Windows when there are easier ways to did it. Why only relying on MS, when the open source community has better options for the requested feature????

The WPF team would take ages to do this! They'll only add it to .NET 6 (if they even care a little bit about the community).

jmelas commented 2 years ago

It seems to me that this request boils down to these changes: