refactor!: Remove the native default-styles system - #23950
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
StyleHelper.UseNativeFrameNavigation/UseNativeStyle<T> only flipped FeatureConfiguration.Style.UseUWPDefaultStylesOverride. The two Given_AppBarButton tests they wrapped assert DataContext and binding propagation, so they keep their assertions without the native styles. Tests whose subject was the native style itself are removed: TestNativeCommandBarIcon (native CommandBar icon rendering), When_Native_AppBarButton_And_Managed_Popups, Given_NativeFrame, and When_Navigating_NativeFrame_Pages_Get_Collected, which targeted the already-deleted NativeFramePresenter. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Every test in UnoSamples_Tests.NativeCommandBar.cs targeted a sample hosting a NativeDefaultCommandBar or NativeDefaultFrame, so the suite goes with those samples. Buttons_Native follows: its local NativeDefaultButton definitions are wasm:/win:-only, so on Skia it resolved the global native key. The CommandBar_Frame folders are deleted whole, as their navigated pages are referenced only by their sibling frame. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Button_UseUWPDefaultStyles existed only to flip the flag, and Button_Tests held nothing but its already-ignored driver. The native MenuFlyout samples go with them. AppBar_KeyBoard and Buttons keep their samples — both are pinned by Given_FrameworkElement_And_Leak and a keyboard UITest — so only the native Style attributes are dropped. Where a "native" block merely duplicated the plain controls beside it, the duplicate is removed rather than left identical. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The native popup presentation this selected went with the native renderers, and its default came from FeatureConfiguration.Style.UseUWPDefaultStyles, which is removed next. No reader was left in Uno.UI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Generic.Native.xaml templated native views (Toolbar, UINavigationBar, SwitchCompat, UISwitch, ...) that went with the native renderers, so its styles could no longer apply. The whole opt-in system goes with it: the FeatureConfiguration.Style holder, the second style cache in Style.cs, and the not_win:IsNativeStyle="True" generator feature. Style.RegisterDefaultStyleForType loses its isNative parameter, and third-party XAML still carrying IsNativeStyle now fails the build instead of silently registering a style that never resolves. Deleting the native styles is safe because Style.cs fell back to the WinUI style whenever no native one was registered — the WinUI set is complete. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The native-styles, native-frame-nav, and native-frame-nav tutorial pages documented a system that no longer exists; Pivot and ToggleSwitch keep only their WinUI-style sections, and CommandBar loses its two-mode framing now that only the WinUI presentation remains. DatePicker/TimePicker.UseNativeStyle prose stays — those drive the Skia native picker extension and are unrelated. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
MenuFlyoutItemExtensions.IsDestructive and MenuFlyoutExtensions.CancelTextIosOverride were read only by the native iOS MenuFlyout presentation, which went with the native renderers — both attached properties have had no consumer since. Each class held nothing else, so both files go. UICommandExtensions.SetDestructive is left alone: UICommand.IsDestructive is a different member and still drives the native iOS MessageDialog. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
47f1da2 to
b42923e
Compare
77395f3 to
f942cc3
Compare
There was a problem hiding this comment.
Pull request overview
This PR removes Uno’s legacy “native default-styles” subsystem (and the last remaining consumers) now that the native-renderer paths it supported are gone. The change spans build-time resource merging, XAML source generation, runtime style registration/caching, and the associated samples/tests/docs that previously referenced native style keys and native popup/navigation options.
Changes:
- Remove
FeatureConfiguration.Style,Generic.Native.xaml, native style caches/lookup, and theisNativestyle-registration plumbing. - Update the XAML generator to stop emitting native-style registration and to drop
IsNativeStylehandling. - Delete/trim dependent runtime tests, SamplesApp samples/UI tests, and documentation; add package-diff ignore entries for the removed public surface.
Reviewed changes
Copilot reviewed 99 out of 99 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI/XamlMerge.targets | Stop merging the removed Generic.Native.xaml resources. |
| src/Uno.UI/UI/Xaml/Style/Style.cs | Remove native style caches/lookup and simplify default-style registration + resolution. |
| src/Uno.UI/UI/Xaml/Style/Generic/Generic.Native.xaml | Remove the native default styles dictionary (deleted). |
| src/Uno.UI/UI/Xaml/Controls/Flyout/FlyoutBase.cs | Remove UseNativePopup toggle (native flyout presentation removed). |
| src/Uno.UI/UI/UnoNativeDefaultProgressBarReverseBoolConverter.cs | Remove converter used only by native progress bar style (deleted). |
| src/Uno.UI/FeatureConfiguration.cs | Remove FeatureConfiguration.Style holder and its helpers/overrides. |
| src/Uno.UI.Toolkit/MenuFlyoutItemExtensions.cs | Remove iOS-native-MenuFlyout-only attached property (deleted). |
| src/Uno.UI.Toolkit/MenuFlyoutExtensions.cs | Remove iOS-native-MenuFlyout-only attached property (deleted). |
| src/Uno.UI.Toolkit/LinkerDefinition.net6.0.xml | Remove linker preserve entries for deleted toolkit types. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/MenuFlyoutPages/Native_AppBarButton_Page.xaml.cs | Remove native-AppBarButton test page (deleted). |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/MenuFlyoutPages/Native_AppBarButton_Page.xaml | Remove native-AppBarButton test page XAML (deleted). |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_NativeFrame.cs | Remove native frame navigation runtime tests (deleted). |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_MenuFlyout.cs | Remove runtime test that depended on native frame navigation + native popup toggles. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Frame.cs | Remove test that depended on NativeDefaultFrame + native presenter behavior. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_CommandBar.cs | Remove native CommandBar icon pixel test that depended on native rendering. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_AppBarButton.cs | Rebase DataContext/binding assertions onto non-native navigation/style path. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/CommandBarTests.xaml.cs | Remove native CommandBar test page (deleted). |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/CommandBarTests.xaml | Remove native CommandBar test page XAML (deleted). |
| src/Uno.UI.RuntimeTests/Helpers/StyleHelper.cs | Remove helpers for forcing native styles during tests. |
| src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Reflection.cs | Remove special-casing that previously ignored IsNativeStyle. |
| src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs | Stop filtering/registrations based on IsNativeStyle; emit 2-arg registration call. |
| src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/CommandBarTests/UnoSamples_Tests.NativeCommandBar.cs | Remove native CommandBar UI test suite (deleted). |
| src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/ButtonTests/UnoSamples_Test_NativeButtons.cs | Remove native buttons UI tests (deleted). |
| src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/ButtonTests/Button_Tests.cs | Remove UI test validating UseUWPDefaultStyles (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/MenuFlyoutTests/MenuFlyout_IosNative.xaml.cs | Remove sample relying on native MenuFlyout popup + toolkit properties (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/MenuFlyoutTests/MenuFlyout_IosNative.xaml | Remove sample relying on native MenuFlyout popup + toolkit properties (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/MenuFlyoutTests/MenuFlyout_DroidAltTab.xaml.cs | Remove Android sample relying on native CommandBar style + native popup (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/MenuFlyoutTests/MenuFlyout_DroidAltTab.xaml | Remove Android sample relying on native CommandBar style + native popup (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Native_Frame/Page_With_CommandBar_TextBlock.xaml.cs | Remove native-frame navigation sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Native_Frame/Page_With_CommandBar_TextBlock.xaml | Remove native-frame navigation sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Native_Frame/Page_Detail.xaml.cs | Remove native-frame navigation sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Native_Frame/Page_Detail.xaml | Remove native-frame navigation sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Page3.xaml.cs | Remove native-frame CommandBar long-title sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Page3.xaml | Remove native-frame CommandBar long-title sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Page2.xaml.cs | Remove native-frame CommandBar long-title sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Page2.xaml | Remove native-frame CommandBar long-title sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Page1.xaml.cs | Remove native-frame CommandBar long-title sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Page1.xaml | Remove native-frame CommandBar long-title sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Frame.xaml.cs | Remove native-frame CommandBar long-title host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/LongTitle/CommandBar_Frame.xaml | Remove native-frame CommandBar long-title host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CustomContent/CommandBar_Page1.xaml.cs | Remove native-frame CommandBar custom-content sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CustomContent/CommandBar_Page1.xaml | Remove native-frame CommandBar custom-content sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CustomContent/CommandBar_Frame.xaml.cs | Remove native-frame CommandBar custom-content host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CustomContent/CommandBar_Frame.xaml | Remove native-frame CommandBar custom-content host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_TextBox.xaml.cs | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_TextBox.xaml | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_Content.xaml.cs | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_Content.xaml | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_AppBarButton_With_Foreground.xaml.cs | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_AppBarButton_With_Foreground.xaml | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_AppBarButton_Binding.xaml.cs | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_With_AppBarButton_Binding.xaml | Remove native CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_Frame.xaml.cs | Remove native-frame CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Native_Frame.xaml | Remove native-frame CommandBar sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Dynamic.xaml.cs | Remove sample that toggled between WinUI/native CommandBar styles (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/CommandBar_Dynamic.xaml | Remove sample that toggled between WinUI/native CommandBar styles (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Background/CommandBar_Background_Page2.xaml.cs | Remove native-frame CommandBar background sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Background/CommandBar_Background_Page2.xaml | Remove native-frame CommandBar background sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Background/CommandBar_Background_Page1.xaml.cs | Remove native-frame CommandBar background sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Background/CommandBar_Background_Page1.xaml | Remove native-frame CommandBar background sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Background/CommandBar_Background_Frame.xaml.cs | Remove native-frame CommandBar background host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/Background/CommandBar_Background_Frame.xaml | Remove native-frame CommandBar background host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonTitle/CommandBar_Page2.xaml.cs | Remove native-frame CommandBar back-button title sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonTitle/CommandBar_Page2.xaml | Remove native-frame CommandBar back-button title sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonTitle/CommandBar_Page1.xaml.cs | Remove native-frame CommandBar back-button title sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonTitle/CommandBar_Page1.xaml | Remove native-frame CommandBar back-button title sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonTitle/CommandBar_Frame.xaml.cs | Remove native-frame CommandBar back-button title host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonTitle/CommandBar_Frame.xaml | Remove native-frame CommandBar back-button title host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonImage/CommandBar_Page2.xaml.cs | Remove native-frame CommandBar back-button image sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonImage/CommandBar_Page2.xaml | Remove native-frame CommandBar back-button image sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonImage/CommandBar_Page1.xaml.cs | Remove native-frame CommandBar back-button image sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonImage/CommandBar_Page1.xaml | Remove native-frame CommandBar back-button image sample page (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonImage/CommandBar_Frame.xaml.cs | Remove native-frame CommandBar back-button image host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/CommandBar/BackButtonImage/CommandBar_Frame.xaml | Remove native-frame CommandBar back-button image host sample (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/Simple_Button.xaml | Remove explicit native style references from sample. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/Simple_Button_With_CanExecute_Changing.xaml | Remove explicit native style references from sample. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/RadioButton_IsEnabled_Automated.xaml | Remove native-style reference and clean up inline comment. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/CheckBox_Button.xaml | Remove explicit native style references from sample. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/Buttons.xaml | Remove native styles section from sample. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/Buttons_Native.xaml.cs | Remove native-buttons sample code-behind (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/Buttons_Native.xaml | Remove native-buttons sample XAML (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/Button_UseUWPDefaultStyles.xaml.cs | Remove sample validating removed style flag (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/Button_UseUWPDefaultStyles.xaml | Remove sample validating removed style flag (deleted). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml_Controls/Button/AppBar_KeyBoard.xaml | Remove native default style references from sample CommandBar/AppBarButtons. |
| doc/articles/using-uno-ui.md | Remove link to native styles article. |
| doc/articles/Uno.UI.Toolkit.md | Remove documentation for deleted MenuFlyout attached property. |
| doc/articles/uno-development/creating-runtime-tests.md | Remove documentation for deleted StyleHelper native-style helpers. |
| doc/articles/toc.yml | Remove TOC entries for native styles/native frame navigation docs. |
| doc/articles/native-styles.md | Remove native styles documentation page (deleted). |
| doc/articles/migrating-to-uno-7.md | Document the breaking removals and migration guidance for deleted APIs/keys. |
| doc/articles/includes/how-tos-and-tutorials-inline-toc.md | Remove link to native frame nav tutorial. |
| doc/articles/guides/native-frame-nav-tutorial.md | Remove native frame navigation tutorial (deleted). |
| doc/articles/features/native-frame-nav.md | Remove native frame navigation feature doc (deleted). |
| doc/articles/feature-flags.md | Remove section describing UseUWPDefaultStyles. |
| doc/articles/controls/ToggleSwitch.md | Remove native style documentation section. |
| doc/articles/controls/Pivot.md | Remove native style documentation section. |
| doc/articles/controls/MenuFlyout.md | Update to state there is no native popup mode. |
| doc/articles/controls/CommandBar.md | Remove “modes” framing and align docs with single-style-path story. |
| build/PackageDiffIgnore.xml | Add ignore entries for removed public API/members for package diff gate. |
Suppressed comments (1)
doc/articles/controls/CommandBar.md:23
- The padding guidance still refers to "iOS/Native" and "Android/Native", but this PR removes the native-default-styles/native rendering mode. This wording should be updated to avoid implying a native CommandBar mode still exists.
You must use `VisibleBoundsPadding.PaddingMask="Top"` on `CommandBar` to properly support the notch or punch-holes on iOS/Native and Android/Native.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| The `CommandBar` in **Uno** is designed to be used the same way you would use the `CommandBar` on **WinUI**. In most cases, you should refer to the [official `CommandBar` documentation](https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.commandbar). | ||
|
|
||
| This document exists to highlight some of the differences you might encounter when working with the native mode of `CommandBar` on either **iOS** or **Android**. | ||
| This document exists to highlight some of the differences you might encounter when working with `CommandBar` on **iOS** or **Android**. |
| My MyRadioButton_2 | ||
| android:Style="{StaticResource NativeDefaultRadioButton}" | ||
| --> | ||
| <!-- My MyRadioButton_2 --> |
| => UseUWPDefaultStylesOverride[typeof(TControl)] = useUWPDefaultStyle; | ||
| } | ||
|
|
||
| public static class TextBlock |
|
|
|
The build 225725 found UI Test snapshots differences: Details
|
|
|
Removing the CommandBar "Modes" section left its subsections orphaned under the h1 (MD001), and "Relatedly" is not in the cSpell dictionary.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23950/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23950/docs/index.html |
|
The build 225804 found UI Test snapshots differences: Details
|
|
|
GitHub Issue: Part of #8339
Important
Stacked on #23949 — this PR is based on
dev/xygu/20260803/drop-feature-flags-2,so review only the last 7 commits. GitHub retargets this to
feature/breakingchangesautomatically once the base PR merges.
PR Type:
🔄 Refactoring (no functional changes, no api changes)
What changed? 🚀
Removes Uno's native default-styles system. Unlike the dead flags in the base PR, this
was a live subsystem:
FeatureConfiguration.Style.UseUWPDefaultStyleswas the entry pointto
Generic.Native.xaml(803 lines), a second style cache inStyle.cs, and anot_win:IsNativeStyle="True"XAML-generator feature.It can no longer do anything useful. Those styles templated native views —
Toolbar,UINavigationBar,SwitchCompat,UISwitch,NativePivotPresenter,NativeFramePresenter,SlidingTabLayout,ExtendedViewPager— every one of which wentwith the native renderers.
Deleting them is safe:
Style.GetDefaultStyleForTypefell back to the WinUI stylewhenever no native style was registered, which proves the WinUI set is complete and native
was strictly additive opt-in. No control can end up unstyled.
Seven commits, ordered consumers first, engine last so each one builds on its own:
refactor!: Remove native-style runtime tests and helpers—StyleHelper.UseNativeStyle<T>()/UseNativeFrameNavigation()and the tests that used them.refactor!: Remove native CommandBar samples and tests— the 12-testUnoSamples_Tests.NativeCommandBarUI-test suite plus the samples it drove.refactor!: Drop native style references from samples— retained samples lose theirNativeDefault*/Android*Style/iOSButtonStylereferences.refactor!: Remove FlyoutBase.UseNativePopup— its default was!FeatureConfiguration.Style.UseUWPDefaultStyles, so commit 5 would have stranded it.refactor!: Remove native default styles— the engine: theFeatureConfiguration.Styleholder, the
_nativeLookup/_nativeDefaultStyleCachepair, theisNativeparameter onStyle.RegisterDefaultStyleForType,Generic.Native.xamland its_NonMergedXamlResourcesentry,UnoNativeDefaultProgressBarReverseBoolConverter, andthe generator's
IsNativeStylehandling.docs: Trim prose for removed native styles.refactor!: Remove native iOS MenuFlyout toolkit extensions—Uno.UI.Toolkit'sMenuFlyoutItemExtensions.IsDestructiveandMenuFlyoutExtensions.CancelTextIosOverride. Both attached properties were read only bythe native iOS
MenuFlyoutpresentation and have had no consumer since it wasremoved; commit 3 deleted their last in-repo usage. Neither class held anything else, so
both files go, along with their two
LinkerDefinition.net6.0.xmlpreserve entries.UICommandExtensions.SetDestructiveis deliberately kept —UICommand.IsDestructiveis a different member and still drives the native iOS
MessageDialog.Coverage notes (deliberate, not accidental)
Given_CommandBar.TestNativeCommandBarIconwas the only coverage of "AppBarButtonForegroundreaches the icon" — it rendered the native bar and asserted a red pixel.There is no native icon left to assert against, so the coverage is retired rather than
ported.
Given_AppBarButton.Check_DataContext_Propagation/Check_Binding_No_DataContextwereunwrapped from
UseNativeFrameNavigation()with every assertion kept. They nowexercise the WinUI
CommandBarstyle; both pass (see Validation).Validation
Per
debugging-discipline.md, labelled by evidence type. All local evidence isSkia desktop, net10.0 — Android/iOS/WASM TFMs are left to CI (no local Mac, and the
Android workload restore is broken on this machine).
Generic.Native.xamldefined —NativeDefault*(10),AndroidButtonStyle,AndroidCheckBoxStyle,AndroidRadioButtonStyle,iOSButtonStyle,IosPickerFlyoutTextButtonStyle,LeftDrawerSplitViewStyle,RightDrawerSplitViewStyle,NativeDefaultSplitViewOpenPaneLength,nativeDefaultProgressBarReverseBool—case-insensitively across
src/anddoc/. Nothing outside the deleted file resolvedany of them. This mattered: a missing
StaticResourcekey is a runtimeXamlParseException, which a compile gate cannot catch.Uno.UI.UnitTests,SamplesApp.Skia.Generic, andSamplesApp.UITestsallbuild with 0 errors (the first two also 0 warnings;
SamplesApp.UITestsemits 3pre-existing
MSB3277nunit.enginewarnings).SamplesApp.Skia.Genericis themeaningful gate for commit 5 — it regenerates every sample XAML through the changed
generator.
SamplesApp.UITestsis a separate compile unit that commits 2–3 delete filesfrom, so it was built explicitly. Local builds used
UnoFastDevBuild=true, which skipsanalyzers, so CI is the authority on code-style enforcement.
dotnet test Uno.UI.UnitTests→ 3981 passed, 13 failed, 23 skipped.All 13 failures are
Windows_Globalization.When_Calendar, pre-existing andtimezone-dependent.
Given_Style,Given_AppBarButton,Given_CommandBar,Given_CommandBarFlyout,Given_ContentControl,Given_Flyout,Given_Frame,Given_FrameworkElement,Given_FrameworkTemplatePool,Given_MenuFlyout→177 passed, 5 skipped, 1 failed (re-run after rebasing onto
d16dc1200f). The failureis
Given_FrameworkElement_Opacity.When_Opacity, atolerance: 0pixel assertion on anImageat 50% opacity off by 1/255 per channel (FFFEF3C2vsFFFDF2C2) —verified to fail identically on the base commit, so it is pre-existing.
dotnet xstyler -d src/SamplesApp -r -p→ 1521 of 1521 files pass.Note
Reproducing the runtime run locally on Windows currently needs
FeatureConfiguration.Rendering.UseVulkanOnWin32 = false(or.RenderingBackend(Win32RenderingBackend.OpenGL)). With the Vulkan default, the test hostdies mid-run with
0xC0000005inSkiaSharp.SkiaApi.sk_refcnt_safe_unrefduringSKSurfacefinalization and writes no results file. This is unrelated to this PR — itreproduces on
feature/breakingchanges(d16dc1200f) with none of these commits applied.It likely goes unnoticed in CI, where no Vulkan-capable GPU is present.
Follow-ups found, deliberately left out of scope
Uno.UI.Toolkit.CommandBarExtensionsis public API with zero readers insrc/— itsconsumer was the native
CommandBar, removed before this branch. Unlike the twoMenuFlyout*extensions handled in commit 7, it has several members and is stillextensively documented, so retiring it warrants its own change.
CommandBar.mdstill carries ~780 lines documentingCommandBarExtensions. This PR onlyremoves the two-mode framing that commit 5 invalidated; the rest needs a docs pass
alongside that API decision.
UnoMetrics.TextBlock.MeasureCacheHits/MeasureCacheMisseshave no writer left, so theyread 0 forever, while 4 samples still display them.
Generic.Native.xamlimportedUno.UI.Controls.LegacyandUno.UI.Controls; whether anyof those types existed only to serve native styles is a separate question.
Note
build/PackageDiffIgnore.xml's entry for the generic methodSetUWPDefaultStylesOverride<TControl>has no precedent in the file andgeneratepkgdiff.exeis not checked in, so its mangling could not be verified locally.If the
generatepkgdiffgate fails, the exactfullNamefrom that run is the fix.PR Checklist ✅
Screenshots Compare Test Runresults.Breaking change impact and migration path
Breaking, intentionally, and scoped to the 7.0 major. Three distinct impacts:
FeatureConfiguration.Style(UseUWPDefaultStyles,UseUWPDefaultStylesOverride,SetUWPDefaultStylesOverride<TControl>(),ConfigureNativeFrameNavigation()),FlyoutBase.UseNativePopup,UnoNativeDefaultProgressBarReverseBoolConverter, and the twoUno.UI.Toolkitattachedproperties
MenuFlyoutItemExtensions.IsDestructive/MenuFlyoutExtensions.CancelTextIosOverride. Migration: delete the usage — no runtimebehavior changes, since the native paths are already gone. For a destructive-looking
MenuFlyoutItem, style it directly.NativeDefault*/Android*Style/iOSButtonStyle/ drawer-style keys. Migration: drop theStyle="{StaticResource NativeDefault…}"; the control falls back to the WinUI defaultstyle it already used whenever no native style was registered.
not_win:IsNativeStyle="True"on aStyleis no longerrecognized, so third-party XAML carrying it now fails the XAML build instead of
silently registering a style that can never resolve. Migration: remove the
attribute. Relatedly,
Style.RegisterDefaultStyleForType(Type, IXamlResourceDictionaryProvider, bool)losesits
isNativeparameter; it is[EditorBrowsable(Never)]and normally only emitted byXAML-generated code, so a rebuild regenerates the correct call.
All three are documented in
migrating-to-uno-7.md.