Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spec] Themes Implementation in Winforms #5166

Open
davidbuckleyni opened this issue Jun 28, 2021 · 13 comments
Open

[Spec] Themes Implementation in Winforms #5166

davidbuckleyni opened this issue Jun 28, 2021 · 13 comments
Assignees
Labels
api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation area-Theming tenet-modernization Modernizing WinForms UI
Milestone

Comments

@davidbuckleyni
Copy link

davidbuckleyni commented Jun 28, 2021

Please bring the ability of themes to winforms every other platform has it but WinForms.

We should be able to set the theme on startup and change it on the fly with a listener.

Should be something like this

services.configure(themeName);

This would then look in resources.resx for dark or light theme pallets. That could be used to style the entire application for example

DarkControlColor

There should also be some way of getting the value from here as some sort of enumeration query able. And be able to retrive the system colours once selected. Making it that the above is not necessary with the resources.

For example an internal enum that would pick up any custom themes the user has created.

NameSpace Suggestion:

Microsoft.WInforms.AppThemes

Enum Suggestion:

public enum AppThemeEnum
{
   Unspecified,
   Light,
   Dark,
   UserTheme
}

Detect & Change User Interface Style
DeviceInfo

API DESCRIPTION
AppTheme CurrentAppTheme What is the actual theme
AppTheme.ApplyTheme This can be called from the this.ApplyTheme maybe they don't want all forms to be theme.

The theme should also allow us to implement rounded corner where we could set a radius of the corner in what ever dpi the user wanted. Be it inches pixels cm mm.

Already
While this is implemented for xamrain it would give a clear conception of what is expected for the winforms flavour.

xamarin/Essentials#927

VisualElement
AppThemeChanged Event

API DESCRIPTION
void AppThemeChanged(AppThemeChangedEventArgs args) Event that is fired whenever the app theme changed
public class AppThemeChangedEventArgs : EventArgs
{
  public AppTheme RequestedTheme { get; }
}

To Apply the theme on a form one could or one could have a class derived from form for example

 public class Form1 : ThemeForm
 {

  }

Resources could be based off Colours per app theme

Theme.AppTheme =AppThemeEnum.Dark

Availability
This should go into .net core,5 and 6.

image

@davidbuckleyni davidbuckleyni added the api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation label Jun 28, 2021
@davidbuckleyni davidbuckleyni changed the title Themes Implementation in Winforms [Spec] Themes Implementation in Winforms Jun 28, 2021
@merriemcgaw
Copy link
Member

This is absolutely something that is on our long term roadmap. We have to work with Windows to make sure that some of the Windows APIs we need are made public so we can read them as we bring up the form. These are discussions that are happening internally and we will be sure to let everyone know when we get a plan in place. This happens to be a favorite topic of mine and @RussKie /

@alanhoman
Copy link
Contributor

Hi @merriemcgaw, I wanted to add that this is extremely important for my organization and I appreciate the high priority you are placing on this feature!

@merriemcgaw
Copy link
Member

I'm glad it's a feature that has so much enthusiasm behind it! I can't make a prediction yet as to when we would release this type of feature, but it is totally on my radar. We'll keep everyone posted as we get more info from Windows and as we are able to settle on a steady design.

@sylveon
Copy link

sylveon commented Jul 1, 2021

Related: microsoft/WindowsAppSDK#41

@davidbuckleyni
Copy link
Author

davidbuckleyni commented Jul 3, 2021

This is absolutely something that is on our long term roadmap. We have to work with Windows to make sure that some of the Windows APIs we need are made public so we can read them as we bring up the form. These are discussions that are happening internally and we will be sure to let everyone know when we get a plan in place. This happens to be a favorite topic of mine and @RussKie /

Glad to here it was talking with ollia on twitter. I love how telerik handle it with the sep dlls for the themes might be worth talking to them

@davidbuckleyni
Copy link
Author

Related: microsoft/WindowsAppSDK#41

That only deals with UWP and WPF Im talking winforms here

@mdtauk
Copy link

mdtauk commented Jul 3, 2021

Ideally it should be possibly to specify a bundled MSStyles with values for Light and Dark control resource and colours. With an ability to specify Dark or Light as the app's chosen theme, as well as following the OS setting.

Each app could use a locally produced Style - or the current version of WinForms as a package could have a style included to match the version of the OS the app is run on.

The OS can keep it's own UX Theme and MsStyles implementation, but future or updated apps can get updated ones as the future OS design is updated.

@davidbuckleyni
Copy link
Author

Ideally it should be possibly to specify a bundled MSStyles with values for Light and Dark control resource and colours. With an ability to specify Dark or Light as the app's chosen theme, as well as following the OS setting.

Each app could use a locally produced Style - or the current version of WinForms as a package could have a style included to match the version of the OS the app is run on.

The OS can keep it's own UX Theme and MsStyles implementation, but future or updated apps can get updated ones as the future OS design is updated.

If u ever used the telerik ones where their is a theme option on each form that was something like i was thinking but, agreed a global option would be good as well.

@sylveon
Copy link

sylveon commented Jul 3, 2021

That only deals with UWP and WPF Im talking winforms here

The issue I opened on the Windows App SDK repo is about dark theming for Win32/WinForms apps specifically, not WPF nor UWP

@kirsan31
Copy link
Contributor

kirsan31 commented Jul 5, 2021

@merriemcgaw

This is absolutely something that is on our long term roadmap. We have to work with Windows to make sure that some of the Windows APIs we need are made public so we can read them as we bring up the form.

Any hope that this can some how speed up #3691 fixing?

@RussKie
Copy link
Member

RussKie commented Jul 5, 2021

This bug needs to be fixed by the Windows team, it's on their backlog.

@merriemcgaw
Copy link
Member

We haven't gotten any feedback from the Windows team on #3691 but we are asking again. It is on their radar and they've acknowledged it's on their end.

@davidbuckleyni
Copy link
Author

This bug needs to be fixed by the Windows team, it's on their backlog.

Its not a bug if its not their its an enhancement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation area-Theming tenet-modernization Modernizing WinForms UI
Projects
None yet
Development

No branches or pull requests

9 participants