fluent-xaml-theme-editor icon indicating copy to clipboard operation
fluent-xaml-theme-editor copied to clipboard

Fluent for WPF

Open rido-min opened this issue 7 years ago • 2 comments

Do you have any plans to produce WPF Xaml styles to for WPF apps?

rido-min avatar Oct 20 '18 00:10 rido-min

I'm not as familiar with the WPF styling/resource system as I am with UWP XAML's, and in addition this tool uses an API from the latest October 2018 Update for Windows. Not something easily translated into WPF.

That being said, I will look into what having an export for WPF feature might look like.

kikisaints avatar Oct 22 '18 20:10 kikisaints

There are some key differences in WPF.

  1. WPF doesn't have the ThemeResource Markup Extension. Means it doesn't support Dark/Light/HighContrast themes out of the box like UWP does.
  2. That said, the colors in WPF don't come from a specific Theme. Instead some ControlTemplates use parts defined in SystemColors. That class has static properties. For example SystemColors.ControlTextBrush contains the brush for control text, like a Button text. There's a corresponding SystemColors.ControlTextBrushKey property that contains the resource key to overwrite that resource. So you can overwrite it like this:

<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Red"/>

  1. Some WPF ControlTemplates reference other resources, not only those from SystemColors, and they might have also other hardcoded values. I see something like this when I create a copy of the Button Template.

  2. WPF has resources in different assemblies, and those resources are loaded depending on the Windows Theme. There's PresentationFramework.Aero.dll for Aero Theme, PresentationFramework.Classic.dll for classic theme etc. Every Windows Theme specific dll contains a generic.xaml file with all the ControlTemplates and Resources for that specific theme. But as mentioned, nothing for dark/light stuff.

That being said: I think it would be possible to generate something for WPF, but I think it would be different and a lot of work. I totally agree to what you said, @kikisaints . It's

Not something easily translated into WPF

thomasclaudiushuber avatar Nov 03 '18 16:11 thomasclaudiushuber