Skip to content

chore(winui-sync): Onboard Icons at WinUI 2.7.0 - #26678

Open
MartinZikmund wants to merge 4 commits into
masterfrom
dev/mazi/onboard-icons
Open

MartinZikmund wants to merge 4 commits into
masterfrom
dev/mazi/onboard-icons

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #26521, closes https://github.com/unoplatform/uno-private/issues/2619, closes https://github.com/unoplatform/uno-private/issues/2631

Related: #26677 (members left unported), #25595 (open PR touching MakeIconElementFrom).

PR Type:

  • 🤖 Project automation (WinUI port sync onboarding, with port fixes)

What changed? 🚀

Onboards the icon controls to the WinUI Port Sync as one area, icons, recorded at WinUI 2.7.0 (1b5b1a0ccc): IconElement, FontIcon, BitmapIcon, PathIcon, SymbolIcon, IconSourceElement, the IconSource family, ImageIcon and AnimatedIcon with its animated visuals. Before adding the area, the port was caught up to the latest stable release, reviewed line by line against it, and its Uno workarounds were audited.

They are one area because they share upstream files: all the core icons live in icon.cpp / icon.h, and AnimatedIcon and ImageIcon build on them.

Mapping

Upstream Uno
controls/dev/AnimatedIcon (folder, with AnimatedVisuals) Controls/AnimatedIcon
controls/dev/IconSource (folder) Controls/IconSource (AnimatedIconSource.cs, ImageIconSource.cs)
controls/dev/ImageIcon (folder) Controls/ImageIcon
controls/dev/Generated/{AnimatedIcon,AnimatedIconSource,AnimatedIconTestHooks,ImageIcon,ImageIconSource}.properties.* the matching *.Properties.cs / property blocks
dxaml/xcp/core/core/elements/icon.cpp, dxaml/xcp/core/inc/icon.h Controls/Icons/*.mux.cs, *.h.mux.cs
dxaml/xcp/dxaml/lib/{IconSource,BitmapIconSource,FontIconSource,PathIconSource,SymbolIconSource,SymbolIcon}_Partial.* Controls/IconSource/*.cs, Icons/SymbolIcon.partial.mux.cs
dxaml/xcp/dxaml/lib/winrtgeneratedclasses/<type>.g.cpp / .g.h for the 11 core types, dxaml/xcp/core/controls/generated/C*IconSource.g.h Icons/*.Properties.cs, the property blocks in IconSource/*.cs
AnimatedIcon/APITests, IconSource/APITests, ImageIcon/APITests Uno.UI.RuntimeTests/Microsoft/UI/Xaml/Controls/{AnimatedIcon,IconSource,ImageIcon}
AnimatedIcon/TestUI, ImageIcon/TestUI SamplesApp.Samples/.../AnimatedIconTests, .../ImageIconTests
  • The core files sit in folders shared with other controls, so they are listed one by one.
  • ImageIcon/InteractionTests is not mapped and was not ported (interaction tests are out of scope for now).
  • No theme XAML is mapped. The only upstream style is ImageIcon.xaml, an empty Style, with an empty ImageIcon_themeresources.xaml. Uno has no copy. Both files sit in the mapped controls/dev/ImageIcon folder, so a future change shows up in the sync diff.
  • Upstream has no Strings for these controls.

Starting point

The headers on master were mixed: the animated visuals at 5f9e85113 (March 2026), the IconSource family and ImageIcon at 1.4.2, a few AnimatedIcon files at older commits from before the controls/dev layout, and the six core icon files with no header at all (they were Uno-written, not ports). 1.4.2 is the oldest tag the headers name, so the upstream changes below are listed from there. The core icons were re-ported from icon.cpp / icon.h, and the whole port was then reviewed against 2.7.0.

Upstream changes 1.4.2 → 2.7.0

Change Verdict
icon.cpp: CSymbolIcon::ConvertSymbolValueToGlyph (legacy E0xx-E5xx symbol values mapped to current glyphs) Ported (SymbolIcon.mux.cs)
icon.cpp, ImageIcon.cpp: opt-in IconNoGridOptimization (no Grid around the TextBlock / Image) Skipped: Uno has no optional-change mechanism to opt in with. The default path is ported. ImageIcon.OnApplyTemplate handles both tree shapes, as upstream. See #26677
icon.h: SAL annotations, m_fontSize{} Not applicable (C++ only)
IconSource_Partial.cpp: CreateIconElement sets Foreground only when the source has one Ported
IconSource/APITests: +136 lines of new tests Ported
ImageIcon/APITests: checks the Image is loaded Ported, with a marked #if HAS_UNO branch for the Grid (see above)
AnimatedIcon/TestUI: classes made partial (6 files) Ported with the samples
AnimatedVisuals: BUILD_WINDOWS include block removed Not applicable (C++ only). Unchanged since 5f9e85113
SymbolIcon_Partial.cpp, ImageIcon.vcxitems: annotation and project changes Not applicable
ImageIcon/InteractionTests Not applicable (out of scope)

Between 2.6.5 and 2.7.0 nothing changed in any mapped file.

Line-by-line review against 2.7.0

Upstream Uno Result
icon.cpp / icon.h Icons/{IconElement,FontIcon,BitmapIcon,PathIcon,SymbolIcon,IconSourceElement}.mux.cs, .h.mux.cs Re-ported 1:1. Each icon builds its child in ApplyTemplate, inside the transparent root Grid (AddChildElement / RemoveChildElement / GetChildElementNoRef / UpdateLinkedChildProperty). FontIcon mirrors itself for MirroredWhenRightToLeft on enter and on FlowDirection changes. IconSourceElement binds the created icon to its source and binds Foreground only when the source sets one. Marked: text formatting inheritance (Uno pushes Foreground and the font properties to the child), BitmapIcon tinting (Image.MonochromeColor instead of a tinted WriteableBitmap), Uno's symbols font. Not ported, marked: the Create type converters and the no-Grid optimization (#26677)
SymbolIcon_Partial.cpp SymbolIcon.partial.mux.cs Matches
*.g.cpp / .g.h for the 11 core types *.Properties.cs, IconSource/*.cs Property surfaces match
IconSource_Partial.cpp and the four derived *_Partial.cpp IconSource/{IconSource,FontIconSource,BitmapIconSource,PathIconSource,SymbolIconSource}.cs Matches: CreateIconElement applies Foreground only when set and tracks created elements weakly; OnPropertyChanged2 forwards to the live elements (routed from each property's changed callback, marked)
AnimatedIconSource.cpp, ImageIconSource.cpp same-named .cs Matches
ImageIcon.cpp ImageIcon.cs, ImageIcon.Uno.cs Matches. Marked: WinUI derives ImageIcon from BitmapIcon natively, so Uno creates the Image itself
AnimatedIcon.cpp / .h, test hooks AnimatedIcon.cs, .Header.cs, AnimatedIconTestHooks.cs Matches member by member, including the queue behaviors and the transition fallback chain. Marked differences are in the workaround table
AnimatedVisuals/* AnimatedVisuals/* Unchanged upstream since their header commit. Not re-read line by line here; covered by Given_AnimatedBackVisualSource, Given_AnimatedIcon and the ported page
API tests *.mux.cs Every upstream test method exists: AnimatedIconTests 10, IconSourceApiTests 6 (plus 4 kept from an older upstream version), ImageIconTests 1. None is disabled
AnimatedIcon/TestUI, ImageIcon/TestUI samples Ported from 2.7.0 (see below)

All Uno files in the area carry a MUX Reference header naming their upstream file, with no version: areas/icons.json holds it.

Workaround audit

Location What it did / does Verdict Evidence
Core icons Uno-written implementations with manual child handling ("OnApplyTemplate is not called when there is no template", "we must add the child element manually", null-Foreground guard, no IsComposed()) Removed, replaced by the 1:1 port Icon runtime tests pass
SymbolIcon Target glyph worked around a missing WinUI glyph Removed: upstream now maps it to 0xF5F0 Given_SymbolIcon
AnimatedVisuals/*.AnimatedVisual.mux.cs (8 files) Replaced the generated layer TransformMatrix with identity, because the generated matrix (zero on M33) collapsed the layer Removed, the generated matrices are back Given_AnimatedBackVisualSource (22) and Given_AnimatedIcon (18) pass; the icons render in the ported page
AnimatedAcceptVisualSource Helper-folded structure instead of the generated per-layer members Kept, marked A 1:1 re-generation is a separate change
AnimatedIcon.OnLoaded Sets the progress property set's owner visual Kept, marked Uno's compositor only ticks animations on a property set owned by a Visual
AnimatedIcon.MeasureOverride / ArrangeOverride Also measures and arranges the root Grid Kept, marked Without it every animated icon is blank
AnimatedIcon Ancestor state and Foreground brush callbacks registered weakly, re-subscribed on load Kept, marked A long-lived brush or ancestor would otherwise root the icon
IconElement.Foreground Static default instead of the theme-following text default Kept, marked A static DP default cannot follow the theme; inherited values resolve the same in the tree

Samples ported from TestUI

  • AnimatedIconPage (replaces a 23-line placeholder) with AnimatedIconHost, ToggleAnimatedIconHost, the two converters and the LottieGen BrightnessSun visual.
  • ImageIconPage, re-synced with upstream.

Marked differences from upstream:

  • The test hooks are internal on WinAppSDK, so their calls are under #if HAS_UNO, as in the other ported pages.
  • BrightnessSun needs Win2D, which the WinAppSDK head does not reference, so the class and the block using it are Uno-only.
  • That block's Slider binds with {Binding}: the Uno XAML generator rejects a TwoWay x:Bind to an attached property.
  • ToggleAnimatedIconHost registers IconSource with its own type as owner: upstream registers it under AnimatedIconHost, which Uno rejects as a duplicate.
  • The page and the hosts drop their handler on the static LastAnimationSegmentChanged event while unloaded, since SamplesApp keeps running after the sample closes.

Tests

  • Runtime (Skia desktop, local): 135 passed, 0 failed, 2 skipped (both skipped before this PR: Given_SymbolIcon.Validate_Size, ignored for [Epic] Flaky tests roundup #9080, and one Given_CommandBarFlyout case).
    • The area: AnimatedIconTests 10, IconSourceApiTests 10, ImageIconTests 1, Given_AnimatedIcon 18, Given_AnimatedBackVisualSource 22, Given_BitmapIcon 9, Given_FontIcon 8, Given_PathIcon 4, Given_SymbolIcon 8, Given_IconSourceElement 1.
    • Consumers: Given_AppBarButton, Given_CommandBar, Given_CommandBarFlyout, Given_AutoSuggestBox, Given_InfoBadge, InfoBadgeTests.
  • Samples: both ported pages were opened on Skia desktop. The animated icons play their transitions, the state and segment labels update, and the BrightnessSun slider drives its icon; the image icons load PNG and SVG sources.
  • Compile: SamplesApp desktop (with Uno.UI and the runtime tests) builds in Release with analyzers on (no UnoFastDevBuild), at net10.0. The WinAppSDK head was not built locally.
  • Tooling: detect.ps1 -AreaFilter icons reports up to date, and the 138 Pester tests pass. The samples pass the XamlStyler check.

No project or MSBuild files changed.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNu19XJALYCKbepQUqsS

@MartinZikmund MartinZikmund self-assigned this Nov 24, 2026
@github-actions github-actions Bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform area/build Categorizes an issue or PR as relevant to build infrastructure area/automation Categorizes an issue or PR as relevant to project automation labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 15s —— View job


Review summary

Verdict: fix-first (one blocking issue)

Severity Count
High 1
Medium 0
Low 0

This was a targeted review of the diff, not a full line-by-line comparison against upstream. I read the core icon files (IconElement.mux.cs, IconSourceElement.mux.cs, IconSource.cs) and the FileSavePicker.wasm.cs change.

  • Unrelated change: the diff includes a WASM FileSavePicker change that reverts the hasChoiceExtension logic from fix(wasm): Don't double the download file extension #25672. It is not mentioned in the PR description (inline comment posted).
  • Icon port: the 1:1 ports of the core icons look consistent with the upstream structure. Uno-specific deviations are marked with TODO Uno comments.
  • Not verified: I did not build the project or run the runtime tests. The test results come from the PR description.

@mergify

mergify Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

// As in the native picker, a name that already ends with one of the choices' extensions is kept as is.
var fileName = hasChoiceExtension ? SuggestedFileName : SuggestedFileName + extension;
// The mime type is chosen by the extension, and we cannot reliably send multiple mime type in the browser
var fileName = SuggestedFileName + extension;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change is unrelated to the icons onboarding, and it looks like a revert. It drops the hasChoiceExtension check that #25672 (merged just before this branch) introduced. With the check gone, a suggested name that already ends in a choice extension (for example report.txt with a .txt choice) is saved as report.txt.txt on WASM.

It was probably brought in by a bad conflict resolution or a stale merge. Please restore it, or move the change to its own PR with a test and an explanation. The PR description says nothing about it.

@MartinZikmund MartinZikmund removed the platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform label Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 12s —— View job


Review update

Verdict: no blocking issues found in this pass. I did not do a new line-by-line review of the icon port.

Retracting the earlier FileSavePicker.wasm.cs finding. It looks like a false positive, probably from the review diffing against a stale base:

  • git diff origin/master...HEAD --name-only lists no FileSavePicker file, and this PR's 94 changed files don't include it.
  • src/Uno.WinRT/Storage/Pickers/FileSavePicker.wasm.cs on this branch still has the hasChoiceExtension logic from fix(wasm): Don't double the download file extension #25672 (lines 99–105).
  • No src/Uno.WinRT file differs between origin/master and HEAD.

That inline comment can be resolved. It should not block merge.

Not verified: I did not build or run tests. The test results are taken from the PR description.


var scaleTransform = fontIcon.RenderTransform as ScaleTransform;
Assert.IsNotNull(scaleTransform);
Assert.AreEqual(-1.0, scaleTransform.ScaleX);
Comment on lines +61 to +76
if (GetChildElementNoRef() is Image image)
{
if (ShowAsMonochrome)
{
// If a valid brush has been set, then we'll use its RGB values, otherwise
// we'll use white.
image.MonochromeColor = pBrush?.Color ?? Colors.White;
}
#if HAS_UNO
else
{
// TODO Uno specific: WinUI keeps the previous tint until the image reloads.
image.MonochromeColor = null;
}
#endif
}
{
partial class MockIAnimatedIconSource2 : IAnimatedVisualSource2
{
Dictionary<string, double> markers = new Dictionary<string, double>();
{
Dictionary<string, double> markers = new Dictionary<string, double>();

IAnimatedVisualSource2 visual = new Controls_02_Hamburger();
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 248689 found UI Test snapshots differences: skia-linux-screenshots: 263, skia-windows-screenshots: 269

Details
  • skia-linux-screenshots: 263 changed over 2504

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AutoSuggestBox_Icons.png-dark
    • Basics.png-dark
    • AutoSuggestBox_Icons.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png
    • ComboBox_MaxDropdownHeight.png-dark
    • ComboBox_MaxDropdownHeight.png
    • Accessibility_Showcase.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppWindowTitleBar Properties.png-dark
    • Basics.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_CornerRadius_BorderThickness.png
    • Accessibility_Showcase.png-dark
  • skia-windows-screenshots: 269 changed over 2504

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedIconPage.png
    • AutomationProperties_AutomationId.png
    • Buttons.png-dark
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • AnimatedVisualsTestbedPage.png-dark
    • Border_CornerRadius_Binding.png-dark
    • Border_CornerRadius_Binding.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • AnimatedBackVisualSourceSamplePage.png-dark
    • AnimatedIconPage.png-dark
    • AutoSuggestBox_BitmapIcon.png-dark
    • AutoSuggestBox_BitmapIcon.png
    • Basics.png-dark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WinUI Port Sync: track Icons

3 participants