1

If you want to use the default styles, colors, etc..., you need to bring them from the generic.xaml file that comes with WindowsAppSDK NuGet packages.

Hence the question, where is located the generic.xaml file?

Andrew KeepCoding
  • 7,040
  • 2
  • 14
  • 21

1 Answers1

6

You can find the default generic.xaml inside each WindowsAppSDK NuGet package folder.

%USERPROFILE%\.nuget\packages\microsoft.windowsappsdk

For example, in the case of WindowsAppSDK v1.2.230118.102, you can find 3 generic.xaml files.

First, let's locate the folder for the WindowsAppSDK v1.2.230118.102 NuGet package.

%USERPROFILE%\.nuget\packages\microsoft.windowsappsdk\1.2.230118.102

or

C:\Users\USERNAME\.nuget\packages\microsoft.windowsappsdk\1.2.230118.102

Note: Replace USERNAME with your user name.

Now, inside this folder you'll find 3 generic.xaml files.

  • \lib\net6.0-windows10.0.17763.0\Microsoft.WinUI\Themes\generic.xaml
  • \lib\net6.0-windows10.0.18362.0\Microsoft.WinUI\Themes\generic.xaml
  • \lib\uap10.0\Microsoft.UI\Themes\generic.xaml

AFAIK, these generic.xaml files are identical as long as they belong the same WindowsAppSDK version. But keep in mind that generic.xaml might be different between WindowsAppSDK versions.

If WinUI 3 gets to be open sourced, I guess we'll be able to get the generic.xaml file from the repo. But for now, this is the way to go.

UPDATE

Additional sources thanks to @YangXiaoPo-MSFT and @mm8:

Andrew KeepCoding
  • 7,040
  • 2
  • 14
  • 21
  • 1
    microsoft-ui-xaml [build project](https://github.com/microsoft/microsoft-ui-xaml/blob/871c27e3681787d007c1d51c64ba4873e35e75c6/build/NuSpecs/MUXControlsFrameworkPackage.nuspec#L31) shows the output. Also see [XAML theme resources](https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-theme-resources). – YangXiaoPo-MSFT Feb 02 '23 at 07:06
  • 1
    The uncompiled styles and templates can be found on [GitHub](https://github.com/microsoft/microsoft-ui-xaml/tree/main/dev) – mm8 Feb 02 '23 at 14:25
  • Thanks @YangXiaoPo-MSFT, @mm8! I didn't know about those sources. Good to learn new things. – Andrew KeepCoding Feb 02 '23 at 23:17