Repository navigation
feat: Replace Generic.xaml resources with WinUI styles - #21513
Conversation
Generic.xaml resources with WinUI stylesGeneric.xaml resources with WinUI styles
There was a problem hiding this comment.
Pull Request Overview
This PR replaces Generic.xaml resources with WinUI styles by removing platform-specific style declarations from TwoPaneView and ScrollViewer/ScrollBar XAML files and improving error messaging in the XAML generator.
- Removes entire TwoPaneView_v1.xaml and TwoPaneView_rs1.xaml resource files
- Eliminates platform-specific style declarations from ScrollViewer and ScrollBar XAML files
- Enhances error messaging in XamlFileGenerator to include property and type information
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| TwoPaneView_v1.xaml | Complete removal of TwoPaneView style definitions and resource dictionary |
| TwoPaneView_rs1.xaml | Complete removal of TwoPaneView style definitions (already commented out) |
| ScrollViewer.xaml | Removes platform-specific style declarations at end of file |
| ScrollBar.xaml | Removes platform-specific style declarations at end of file |
| XamlFileGenerator.cs | Improves error message to include property name and type information |
686dacc to
97455ff
Compare
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days. |
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days. |
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days. |
|
This PR was closed because it has been stalled for 10 days with no activity. |
|
Claude finished @morning4coffe-dev's task in 10m 6s —— View job PR Review —
|
|
Claude finished @morning4coffe-dev's task in 2m 34s —— View job PR Review —
|
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
WinUI accepts Target="ContentRoot.Grid.Column" as well as "ContentRoot.(Grid.Column)". Uno read the bare form as a Grid sub-property and silently ignored the setter, so WinUI's SplitView template never moved the content beside an inline pane. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011VUyB4pHCfJMGmHzN8TWfF
On WinUI the idle wait can return before the arrange that applies the OpenInlineLeft setters, so the content offset read was stale. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
As on WinUI 3, MenuBar and MenuBarItem styles and their theme resources now come only from XamlControlsResources. The Uno.UI copies were an older WinUI 2 port, shadowed whenever it is merged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
As on WinUI 3, every dictionary WinUI ships from controls/dev now lives in Uno.UI.FluentTheme only. Uno.UI duplicates are deleted. BreadcrumbBar, InfoBadge, ItemContainer, ItemsView, PipsPager, RefreshContainer, RefreshVisualizer, RadioMenuFlyoutItem, ScrollView and SelectorBar move there unchanged. ProgressRing's AnimatedVisualPlayer template replaces the excluded FluentTheme copy, and ScrollViewer_themeresources is WinUI's file, DefaultScrollViewerStyle included. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
The dictionaries that drifted little or moderately from winui3/release/2.5.1 are now verbatim copies, along with MenuFlyout and Button. The per-OS RevealBrush and *_rs1 dictionaries give way to WinUI 3's single RevealBrush_themeresources, and Common_themeresources_any and ListBox resources are added. The remaining Uno deltas live in UnoFluentOverlay.xaml (popup backgrounds, FlipView panel, picker highlight). Heavily drifted files are #25120. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
WinUI's dxaml FlipView style uses VirtualizingStackPanel, which is not implemented on Skia, so the overlay swaps in a StackPanel as it does for GridView. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
WinUI 2.5.1 dropped VerifyFontFamilyForChevron when the chevron became an AnimatedIcon, and its MediaTransportControls template has no CompactOverlayButton. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG
Tracked in #25151. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YY8tbyuyYCBAZWQQkpQyiL
Restores the MUX Reference header the re-sync dropped from 63 dictionaries, now pointing at the winui3/release/2.5.1 source each one is a verbatim copy of. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017TzDba3gSK3uYpvLmmBmaa
When_RightPane_Clipped screenshot the pane mid-way through WinUI's 0.35s compact overlay slide, so the expanded and compact-again checks failed deterministically on Skia. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011CiTALQs7Yrygq4kYHtzaM
Covers the SamplesApp shell narrowing below its AdaptiveTrigger: the content must span the full width again, however the pane reached the inline state. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011CiTALQs7Yrygq4kYHtzaM
|
Claude finished @MartinZikmund's task in 15s —— View job Review of the latest commits (
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21513/wasm-skia-net9/index.html |
|
The build 238761 found UI Test snapshots differences: Details
|
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21513/docs/index.html |
GitHub Issue: closes #12839, closes #25015, closes #25019
PR Type:
✨ Feature, 🐞 Bugfix
What changed? 🚀
Uno's
Generic.xamlwas a heavily modified copy of an old UWPgeneric.xaml. This PR replaces it with a verbatim copy of WinUI'ssrc/dxaml/xcp/dxaml/themes/generic.xaml(microsoft-ui-xamlwinui3/release/2.5.1, which has the same bytes as 1.7.3). Updating to a newer WinUI release is now a copy-paste: the file only adds aMUX Referenceheader line, like the other ported WinUI files.The same goes for the MUXC layer:
Uno.UI.FluentTheme(XamlControlsResources) is re-synced with the same WinUI release, and Uno.UI no longer carries its own copies of dictionaries that WinUI ships only throughXamlControlsResources.Layering
This mirrors WinUI:
Generic.xamlis the dxaml (system-control) layer, andUno.UI.FluentTheme(XamlControlsResources) is the MUXC CommonStyles layer. Note that WinAppSDK's packagedThemes/generic.xamlis a merged reference artifact (GenerateMergedXaml.ps1), not the runtime layer.Uno-specific deltas no longer live inside
Generic.xaml. The only remaining ones are inUnoGenericOverlay.xaml, which is merged intomergedstyles.xamland registered afterGeneric.xaml:ItemsControltemplate, kept untilCItemsControl::ApplyTemplateis ported.WebView/WebView2with theWebViewTemplateRoothost thatCoreWebView2looks up.GridView: WinUI's style with aWrapPanelitems panel, becauseItemsWrapGridis not implemented on Skia.FlipView: WinUI's style with aStackPanelitems panel, becauseVirtualizingStackPanelis not implemented on Skia.XamlControlsResources re-synced with WinUI 2.5.1
One source per dictionary. Every dictionary WinUI ships from
src/controls/devnow lives only inUno.UI.FluentTheme. The Uno.UI duplicates are deleted. BreadcrumbBar, InfoBadge, ItemContainer, ItemsView, PipsPager, RefreshContainer, RefreshVisualizer, RadioMenuFlyoutItem, ScrollView and SelectorBar moved over unchanged. The ProgressRing template (WinUI'sAnimatedVisualPlayerone) replaces FluentTheme's excluded copy.DefaultScrollViewerStylenow comes from WinUI'sScrollViewer_themeresources.xaml.Verbatim copies. 103 FluentTheme dictionaries are now byte-for-byte copies of
winui3/release/2.5.1. Those are all the files that drifted up to ~100 lines, plus MenuFlyout and Button. Uno-only deltas that targeted native renderers, such asFauxGradientBorderPresenterand literal durations, are gone.WinUI 3 file set. The six per-OS
RevealBrush_*dictionaries are replaced by WinUI 3's singleRevealBrush_themeresources.xaml.SplitButton_rs1andTwoPaneView_rs1are deleted, andCommon_themeresources_anyandListBox_themeresourcesare added.Remaining Uno deltas. These sit in
Resources/PriorityOverlay/UnoFluentOverlay.xaml, which merges last:MenuFlyout/CommandBarFlyoutbackgrounds, because popups do not support aSystemBackdropyet.FlipViewpanel, as above.MonochromaticOverlayPresenterrenders on Skia ([Skia] Support forMonochromaticOverlayPresenter#14353).One line is also removed from
Deprecated_themeresources.xaml: an empty implicitProgressBarstyle.Uno.XamlMerge.Taskdoes not de-duplicate it againstcontrols:ProgressBar.Not re-synced yet. CalendarView, ListViewItem, GridViewItem, CommandBar and
ProgressBar_themeresourcesstill drift heavily: Re-sync the heavily drifted FluentTheme styles with WinUI 2.5.1 #25120.Making WinUI's templates work unmodified
Storyboard.TargetNamenow compiles and no-ops at runtime, as in WinUI. Previously it failed the build; the MediaTransportControlsFocusedstate hits this. Fixes Storyboard.TargetName that does not resolve in scope breaks the build instead of no-op'ing #24432.Value="") parses as 0, matchingCDouble::CreateCValue.Target="ContentRoot.Grid.Column"), used throughout WinUI's templates, now apply in both the generator andXamlReader; they were silently ignored.CSplitView'sPaneClipRectanglehandling and theOverlayVisibilityStates/LightDismissOverlayModelogic, so WinUI's and MUX's templates work as-is. The Uno-specific SplitView template is gone, and FluentTheme's SplitView resources are re-synced with MUX 2.5.1.IsFullWindowand the presenter's initial visibility are now driven from C# instead of template edits. This also fixes a NullReferenceException whenIsFullWindowwas set before load; such a request now enters full window once the template is applied, as in WinUI'sUpdateIsFullWindow. A re-applied template no longer hides a presenter that already has a source.Removed Uno customizations
Each was audited against WinUI and its relevance now that only Skia rendering remains.
XamlDefault*style keys. WinUI never had them; its public equivalents are CommonStyles'Default<X>Stylekeys inXamlControlsResources. The list is inmigrating-to-uno-7.md.Generic.xamlapplies. The ported CommandBar code expects its parts, such asWindowedPopupPadding.NativeScrollViewerStyleandListViewBaseScrollViewerStyle.ContentDialog/FlyoutPresenterdictionaries. Their flat resources were overriding WinUI's HighContrast values.LoopingSelector.xaml.FallbackColors.rs3/19h1acrylic theme resources and every other Uno.UI copy of a MUXC dictionary (see above). As on WinUI 3, these now come only fromXamlControlsResources.CompactOverlayButton: removed, as in WinUI 3's template.Visual impact
Controls that previously had no default style now get WinUI's:
ContentPresenter,GroupItem,Hub,HubSection,ListBox,ListBoxItem,ListPickerFlyoutPresenter,PickerFlyoutPresenter,RichEditBox,SemanticZoom,AppBarElementContainer. In addition:XamlControlsResourcesget WinUI's CommandBar template.SplitView/NavigationViewpane is now clipped the WinUI way.XamlControlsResourcestemplates and colors now match WinUI 2.5.1. Examples: the CheckBox glyph animation,SplitMenuFlyoutItem, the HighContrast resources and the newSubtleButtonStyle.The screenshot comparison needs a careful pass.
Follow-ups (out of scope)
These are tracked separately: #25016 (CalendarView overlays), #25017 (older MUX control ports), #25020 (stale
Darktheme keys; the InfoBar and TreeView entries are gone with this PR) and #25018 (remove the legacyProgressRing). ColorPicker is being re-ported separately. TheSystemColor*placeholder values are #25021, to be fixed with #22851. #25015 (InfoBar/TreeView/RatingControl v1 copies) and #25019 (acrylic) are resolved here by dropping the Uno.UI copies. The heavily drifted FluentTheme dictionaries, popupSystemBackdropsupport and the merge-task fix are #25120.PR Checklist ✅
Screenshots Compare Test Runresults.Breaking changes: the
XamlDefault*,NativeScrollViewerStyle,ListViewBaseScrollViewerStyle,DefaultFlyoutPresenter, ContentLink and legacy ProgressBar resource keys are removed. Apps referencing them should drop theStyleattribute, or useDefault<X>StylewithXamlControlsResources. Controls styled only byXamlControlsResourcesin WinUI no longer get a default template without it, for exampleNumberBox,SplitButtonandProgressRing.IsCompactOverlayButtonVisiblehas no visible effect. The full list is indoc/articles/migrating-to-uno-7.md.Tests:
Given_Storyboard,Given_Parser.When_Empty_Double_Value,Given_ResourceDictionary.When_XName_Used_As_Resource_Key.Given_GenericResources(includingWhen_ScrollViewer_Implicit_Style_Is_Based_On_Defaultand the GridView ordering guard),Given_SplitView(pane clip, compact strip and overlay states, against both the generic and the MUX style),Given_MediaPlayerElement,Given_InfoBar,Given_BreadcrumbBar.Given_ListViewBase.When_ThemeChangeis ignored until Theming (animations) #23491 lands.Locally on Skia Desktop:
Given_RefreshContainer.When_ListViewNestedAndSwipeUpAndDownfailed once and is still unexplained.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q8YHRRzBxd2qi1Abr5cEfG