Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the generic.xaml file located?

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?

like image 709
Andrew KeepCoding Avatar asked Sep 15 '25 05:09

Andrew KeepCoding


1 Answers

Option 1 (open-source): WinUI 3 on GitHub

The WinUI 3 source code is available on GitHub:

  • WinAppSDK v1.7 generic.xaml
  • Uncompiled styles & templates for WinUI 3

The WinUI 3 Gallery app even includes handy links to these styles:

The Source button on the Button page with an option labeled 'Control source code'

Option 2 (local): look in the NuGet package

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.

Further resources

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

  • microsoft-xaml-ui build project shows the path.
  • XAML theme resources

More source code:

  • Older WinUI 3 v1.4 generic.xaml
  • Older uncompiled styles & templates for WinUI 3 v1.4
  • Uncompiled styles and templates for WinUI 2

Updates:

  • July 2025: updated to WinAppSDK v1.7
  • March 2024: added WinUI 3 source links
  • Feb 2023: added WinUI 2 source links
like image 134
Andrew KeepCoding Avatar answered Sep 17 '25 20:09

Andrew KeepCoding