You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The theme specific XAML files (#865) do not contain enough information to be used as-is (#1146).
The Theme Styles that we ship with VS should be updated to correspond with recent .NET Core sources.
We should have a way of generating these theme styles automatically from our sources.
Further, we should work with the VS templating team to ensure that these update Theme Styles are available as an item-template and consumable by the VS IDE at design-time.
Reacted by Shritish, Poopooracoocoo and SteelBlueVision
Are luna/royale themes useful for anything besides backwards compatibility for people referencing them, considering they are based on now unsupported Windows XP? I mean, they are referencing system parameters for colors and sizes which will never occur on a supported system. People can still reference them or copy XP-like styles from existing controls but they'll have to manually adjust them and replace system parameter references by actual values representative for XP systems. Even then some things like non-client areas will never look right because they were never rendered by WPF.
As this is now planning for 5.0, when moving on with WPF for .NET Core you'll probably have a hard time updating existing controls or styling new controls, considering you don't have any place to actually test those (unless you still keep WinXP test machines around just for testing the styles)
Reacted by Symbai, Poopooracoocoo and SteelBlueVision
I'm mostly agree with @weltkante 's opinion. However, I don't think we should simply remove the luna/royale themes, because it is a good template and tutorial for writing WPF styles. On the contrary, I think we should archive them.
In addition, I suggest publishing all themes as separate nupkgs, because they are large and costs much more space when publishing self-contained WPF programs. We can choose which theme to include manually if they are distributed separately.
Since we discussing styles, when I adopt/start planning to contribute to 5.0 I would really, really appreciate some better-designed default styles for WPF apps. I keep joking that all the default WPF styles look like they were designed by the summer intern on his first day at Microsoft some fifteen years ago, and never touched by anyone since. @gix's PresentationTheme.Aero would be a great starting point, but it isn't quite compatible with .NET Core WPF as-is. (I tried changing the packaging to work correctly with Core WPF in gix/PresentationTheme.Aero#2, but I could not excise the use of private reflection which was breaking the theme engine on Core.) Furthermore, as discussed in #110, a separate theme such as this one won't ever be a fully sufficient replacement for the visually sub-par originals.
I would also like to note that I would want to update/refine the Windows 7-era Aero theme, since I greatly prefer the look-and-feel of that theme over the (third-party and in-box) Windows 10-era themes. (Not to mention that some users are still using Windows 7, and I would want to fit into that version of Windows if at all possible.) I would have started work on this task some time ago, except that the theme assemblies are (still!) not open-source, and I cannot start from the XAML files in @vatsan-madhavan's original post because some parts of the Windows 7 theme are implemented in C#, and I want/need to convert it to 100% XAML. Although I agree with @Berrysoft's opinion on the Windows XP themes, please do not archive or delete the Windows 7 theme. Thanks!
With the upcoming WinUI 3.0 release, bringing updated control designs to XAML - perhaps it is time to bring out updated WPF control templates and updated WinForms/Windows GDI controls to match the styling (if not control size and spacing)
I had a thought about this issue. I could start work porting the PresentationTheme.Aero theme XAML into my fork of the WPF repo. I would create new theme assemblies to hold these styles (PresentationFramework.Aero.Win8, PresentationFramework.Aero.Win10, etc).
However, I quickly run into a problem: If I were to change UxThemeWrapper to use a more nuanced algorithm for choosing a theme, I would then break applications that depend on the use of the "Aero2" theme name, as discussed in #1913 (comment). I tried writing code that falls back on Aero2 if the newer names are being used but a resource wasn't found, but I could not wrap my head around the resource lookup code.
I also could try dumping the newer styles into the existing Aero2 DLL, and modify UxThemeWrapper to return a different theme color (currently, it always returns NormalColor), but then I would run into the same compatibility issue. This time, my changes would break apps that expect Aero2.NormalColor.xaml to be used.
If anyone could give me some pointers on how to disentangle SystemResources (and wherever in PresentationFramework the lookup code for controls in third-party assemblies is found), I would greatly appreciate it. Thanks!
Historically the theme engine is supposed to select the XAML files which match the native OS look and feel. Considering that the OS now has two "native" look and feels, win32 and UWP, the whole approach to theming needs to be thought over. I don't think the current engine will be flexible enough to support that, there's #1913 for opening up the theming engine but as I have brought up over there the theming engine is a feature for control authors not for application wide themes (so it would be more appropriate for your usecase than what OP of #1913 desires to use it for)
I don't think replacing the existing themes is the way to go, people will still want to match win32 Desktop themes. There probably could be an application switch to select between win32 and UWP themes.
If anyone could give me some pointers on how to disentangle SystemResources
You need to be more specific, do you mean how the resource dictionaries are resolved (which happens to have some code in that file) or how system resources are resolved? The latter is a big switch block in SystemResourceKey
and wherever in PresentationFramework the lookup code for controls in third-party assemblies is found
Third-party assemblies aren't special, if anything is special then its PresentationFramework itself, but other Microsoft assemblies are just like any other third party assembly, no distinction. All can use ThemeInfoAttribute to configure the lookup and its just that for PresentationFramework it defaults to "external assembly" while the VS generated attribute has other defaults.
Also I think we are running offtopic on this particular issue, it wasn't about modernizing the themes, it was about getting up-to-date XAML published as part of the build process. Currently the XAML is included in VS so it is not in sync with any updates done in this repository (and considering you can reference different versions of the WPF nuget packages VS will have a hard time being in sync with anything once things start to change).
Modernizing the themes should probably have a separate issue and not be mixed with technical issues resolving around publishing XAML source for the designers.
Reacted by William Kent, Jayke R. Huempfner, Poopooracoocoo and SteelBlueVision
It would be cool to somehow override themes with BasedOn without special workarounds. Currently if you load a theme you can't customize controls anymore. It requires hackish workarounds.
Activity
vatsan-madhavan commentedon Jul 26, 2019
/cc @chabiss, @rladuca, @grubioe
/cc @weltkante
weltkante commentedon Jul 26, 2019
Are luna/royale themes useful for anything besides backwards compatibility for people referencing them, considering they are based on now unsupported Windows XP? I mean, they are referencing system parameters for colors and sizes which will never occur on a supported system. People can still reference them or copy XP-like styles from existing controls but they'll have to manually adjust them and replace system parameter references by actual values representative for XP systems. Even then some things like non-client areas will never look right because they were never rendered by WPF.
As this is now planning for 5.0, when moving on with WPF for .NET Core you'll probably have a hard time updating existing controls or styling new controls, considering you don't have any place to actually test those (unless you still keep WinXP test machines around just for testing the styles)
Berrysoft commentedon Jul 28, 2019
I'm mostly agree with @weltkante 's opinion. However, I don't think we should simply remove the luna/royale themes, because it is a good template and tutorial for writing WPF styles. On the contrary, I think we should archive them.
In addition, I suggest publishing all themes as separate nupkgs, because they are large and costs much more space when publishing self-contained WPF programs. We can choose which theme to include manually if they are distributed separately.
wjk commentedon Jul 29, 2019
Since we discussing styles, when I adopt/start planning to contribute to 5.0 I would really, really appreciate some better-designed default styles for WPF apps. I keep joking that all the default WPF styles look like they were designed by the summer intern on his first day at Microsoft some fifteen years ago, and never touched by anyone since. @gix's PresentationTheme.Aero would be a great starting point, but it isn't quite compatible with .NET Core WPF as-is. (I tried changing the packaging to work correctly with Core WPF in gix/PresentationTheme.Aero#2, but I could not excise the use of private reflection which was breaking the theme engine on Core.) Furthermore, as discussed in #110, a separate theme such as this one won't ever be a fully sufficient replacement for the visually sub-par originals.
I would also like to note that I would want to update/refine the Windows 7-era Aero theme, since I greatly prefer the look-and-feel of that theme over the (third-party and in-box) Windows 10-era themes. (Not to mention that some users are still using Windows 7, and I would want to fit into that version of Windows if at all possible.) I would have started work on this task some time ago, except that the theme assemblies are (still!) not open-source, and I cannot start from the XAML files in @vatsan-madhavan's original post because some parts of the Windows 7 theme are implemented in C#, and I want/need to convert it to 100% XAML. Although I agree with @Berrysoft's opinion on the Windows XP themes, please do not archive or delete the Windows 7 theme. Thanks!
mdtauk commentedon Jul 29, 2019
With the upcoming WinUI 3.0 release, bringing updated control designs to XAML - perhaps it is time to bring out updated WPF control templates and updated WinForms/Windows GDI controls to match the styling (if not control size and spacing)
wjk commentedon Sep 20, 2019
I had a thought about this issue. I could start work porting the PresentationTheme.Aero theme XAML into my fork of the WPF repo. I would create new theme assemblies to hold these styles (
PresentationFramework.Aero.Win8,PresentationFramework.Aero.Win10, etc).However, I quickly run into a problem: If I were to change
UxThemeWrapperto use a more nuanced algorithm for choosing a theme, I would then break applications that depend on the use of the "Aero2" theme name, as discussed in #1913 (comment). I tried writing code that falls back on Aero2 if the newer names are being used but a resource wasn't found, but I could not wrap my head around the resource lookup code.I also could try dumping the newer styles into the existing Aero2 DLL, and modify UxThemeWrapper to return a different theme color (currently, it always returns
NormalColor), but then I would run into the same compatibility issue. This time, my changes would break apps that expectAero2.NormalColor.xamlto be used.If anyone could give me some pointers on how to disentangle
SystemResources(and wherever in PresentationFramework the lookup code for controls in third-party assemblies is found), I would greatly appreciate it. Thanks!weltkante commentedon Sep 20, 2019
Historically the theme engine is supposed to select the XAML files which match the native OS look and feel. Considering that the OS now has two "native" look and feels, win32 and UWP, the whole approach to theming needs to be thought over. I don't think the current engine will be flexible enough to support that, there's #1913 for opening up the theming engine but as I have brought up over there the theming engine is a feature for control authors not for application wide themes (so it would be more appropriate for your usecase than what OP of #1913 desires to use it for)
I don't think replacing the existing themes is the way to go, people will still want to match win32 Desktop themes. There probably could be an application switch to select between win32 and UWP themes.
You need to be more specific, do you mean how the resource dictionaries are resolved (which happens to have some code in that file) or how system resources are resolved? The latter is a big switch block in SystemResourceKey
Third-party assemblies aren't special, if anything is special then its PresentationFramework itself, but other Microsoft assemblies are just like any other third party assembly, no distinction. All can use ThemeInfoAttribute to configure the lookup and its just that for PresentationFramework it defaults to "external assembly" while the VS generated attribute has other defaults.
weltkante commentedon Sep 20, 2019
Also I think we are running offtopic on this particular issue, it wasn't about modernizing the themes, it was about getting up-to-date XAML published as part of the build process. Currently the XAML is included in VS so it is not in sync with any updates done in this repository (and considering you can reference different versions of the WPF nuget packages VS will have a hard time being in sync with anything once things start to change).
Modernizing the themes should probably have a separate issue and not be mixed with technical issues resolving around publishing XAML source for the designers.
bugproof commentedon Aug 22, 2020
It would be cool to somehow override themes with
BasedOnwithout special workarounds. Currently if you load a theme you can't customize controls anymore. It requires hackish workarounds.https://stackoverflow.com/questions/2377055/override-overridden-wpf-theme
https://stackoverflow.com/questions/4239714/why-cant-i-style-a-control-with-the-aero-theme-applied-in-wpf-4-0
https://stackoverflow.com/questions/4662052/how-do-i-override-style-in-a-specific-theme
Also, not all controls have
x:Keyso you could override button like:but it won't work for DataGrid for example.