microsoft / fluent-xaml-theme-editor

The Fluent Design XAML theme editor.
MIT License
638 stars 92 forks source link

Fluent for WPF #17

Open rido-min opened 6 years ago

rido-min commented 6 years ago

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

kikisaints commented 6 years ago

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.

thomasclaudiushuber commented 6 years ago

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