Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for WinUI 2.6 styles #6374

Merged
merged 13 commits into from
Sep 10, 2021

Conversation

MartinZikmund
Copy link
Member

GitHub Issue (If applicable): #

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@gitpod-io
Copy link

gitpod-io bot commented Jul 1, 2021

@robloo
Copy link
Contributor

robloo commented Jul 1, 2021

Awesome! Looks like a lot of work.

Could you add a little documentation when you have a chance on how this works? I was wondering how you would be implementing it. I was also never 100% sure how all XAML locations work together: XAML in controls folders, XAML in FluentTheme, all the FluentTheme priority folders, etc.

When porting controls from WinUI library it looks like the XAML generator will work with the original files as-is. Any v1 suffixes will be used for version 1, any files without suffixes will be assumed as the max version (currently 2). So when porting controls like the ColorPicker I can just copy/paste the files no issue.

@MartinZikmund MartinZikmund force-pushed the dev/mazi/fluentv2 branch 3 times, most recently from 8f7d4c8 to d5a4e3a Compare July 12, 2021 15:33
@MartinZikmund
Copy link
Member Author

@robloo you are right, it is probably quite worth documenting 👍 . In short however, the main point of the "Priority" folders is to ensure the files are merged in a order that ensures that the styles that are referenced by other styles occur earlier in the merged file. For example Priority01 contains Common_themeresources as they are referenced almost everywhere. Then AcrylicBrush_themeresources are in Priority02 because they reference things from 01 but are themselves references by things in PriorityDefault for example.

@jeromelaban
Copy link
Member

It's likely that we'll need to update the fluent font to match newer glyphs (like DropDownButton)

@MartinZikmund MartinZikmund marked this pull request as ready for review September 9, 2021 06:24
@MartinZikmund MartinZikmund requested a review from a team September 9, 2021 06:24
@davidjohnoliver
Copy link
Contributor

davidjohnoliver commented Sep 10, 2021

@robloo you are right, it is probably quite worth documenting 👍 . In short however, the main point of the "Priority" folders is to ensure the files are merged in a order that ensures that the styles that are referenced by other styles occur earlier in the merged file. For example Priority01 contains Common_themeresources as they are referenced almost everywhere. Then AcrylicBrush_themeresources are in Priority02 because they reference things from 01 but are themselves references by things in PriorityDefault for example.

No :D This isn't necessary, XAML supports lexically forward references.

The FluentTheme XAML resources are placed into Priority files according to the value of the Priority attribute in the WinUI repo's project structure. Eg:

https://github.com/microsoft/microsoft-ui-xaml/blob/9052972906c8a0a1b6cb5d5c61b27d6d27cd7f11/dev/Materials/Reveal/RevealBrush.vcxitems#L32-L37

The WinUI repo uses the 'Priority' attribute to determine which resource 'wins' in the case of duplicate resource declarations. So in the case that, say, two different XAML files declare a SplartControlForegroundBrush resource, or a default ListViewItem style, the one with higher priority is the one that actually gets included in the amalgamated themeresources.xaml file. That's done here:

https://github.com/microsoft/microsoft-ui-xaml/blob/bbc4549d65222be8fc9deb128afabb624ae191e9/dev/dll/Microsoft.UI.Xaml.vcxproj#L648-L656

We could probably duplicate in detail what the project system is doing, but to save time I used the trick of just putting them in different folders, which achieves the same thing based on the order in which Uno's XAML generation processes files.

This hopefully partially answers the question @robloo posed in #6926 . :)

GitHub
Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications - microsoft-ui-xaml/RevealBrush.vcxitems at 9052972906c8a0a1b6cb5d5c61b27d6d27cd7f11 · microsoft/mi...
GitHub
Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications - microsoft-ui-xaml/Microsoft.UI.Xaml.vcxproj at bbc4549d65222be8fc9deb128afabb624ae191e9 · microso...

Copy link
Contributor

@davidjohnoliver davidjohnoliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked through every line of the imported v2 resources... but I wonder, did you do a search for 'Uno' in the existing v1 resources, and reapply any Uno workarounds to the new resources?

If you haven't done that yet, it might make sense to merge this PR first and then do that, but it should definitely be done.

@MartinZikmund
Copy link
Member Author

@davidjohnoliver Yes, those Uno specifics have been already applied. What's missing are only the LGB border workarounds

@robloo
Copy link
Contributor

robloo commented Sep 10, 2021

@davidjohnoliver Thanks for the info. I'll quote this in the discussion so its all together for eventual documentation :)

@MartinZikmund These files use the same symbol font Unicode points as upstream, correct? I'm going to pull out all the the WinUI glyphs this weekend and hopefully get an initial mapping to the Fluent UI System. Assuming there are no roadblocks rebuilding the Uno symbol font for WinUI 2.6 styles should be relatively quick -- once the mapping is complete.

@jeromelaban
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MartinZikmund MartinZikmund added the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label Sep 10, 2021
@mergify mergify bot merged commit 58323c1 into unoplatform:master Sep 10, 2021
@MartinZikmund MartinZikmund deleted the dev/mazi/fluentv2 branch September 10, 2021 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants