Repository navigation
refactor(controls)!: Reparent RadioMenuFlyoutItem to MenuFlyoutItem (BC52) - #23749
Conversation
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23749/wasm-skia-net9/index.html |
|
The build 222149 found UI Test snapshots differences: Details
|
…BC52) RadioMenuFlyoutItem derived from ToggleMenuFlyoutItem (a Uno divergence: WinUI derives it publicly from MenuFlyoutItem while secretly reusing ToggleMenuFlyoutItem). Reparent it directly to MenuFlyoutItem to match the WinUI public base and drop the twin-IsChecked sync dance. The check/toggle behaviour it used to inherit is now duplicated on RadioMenuFlyoutItem itself: - ChangeVisualState: CheckStates (Checked/Unchecked +WithIcon) keyed on its own IsChecked, mirroring ToggleMenuFlyoutItem. - Invoke: a radio item is always checked on invocation, never toggled off. - IsChecked change drives UpdateVisualState + group selection + the toggle automation event. - OnCreateAutomationPeer returns ToggleMenuFlyoutItemAutomationPeer (matching WinUI's toggle automation surface); that peer gains an internal MenuFlyoutItem ctor and reads IsChecked polymorphically. - HasToggle() returns true so the parent MenuFlyoutPresenter still reserves the check column for radio-only menus (previously inherited from ToggleMenuFlyoutItem). The `new`-shadowed IsChecked/IsCheckedProperty lose their `new` (nothing to hide), the default template retargets its ControlTemplate to RadioMenuFlyoutItem, and the RadioMenuFlyoutItem _skipBaseTypes workaround is removed from the sync generator (regenerated stub now carries the MenuFlyoutItem base). No PackageDiffIgnore entries needed: base-type changes are untracked and the declared IsChecked/IsCheckedProperty signatures are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
8f42956 to
d15c582
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23749/wasm-skia-net9/index.html |
|
The build 222538 found UI Test snapshots differences: Details
|
GitHub Issue: #8339
PR Type:
💬 Other... Breaking change (API alignment with WinUI)
What changed? 🚀
Reparents
RadioMenuFlyoutItemfromToggleMenuFlyoutItemtoMenuFlyoutItem(BC52 of the Phase 5 breaking-changes wave).WinUI derives
RadioMenuFlyoutItempublicly fromMenuFlyoutItemwhile secretly reusingToggleMenuFlyoutItem. C# has no such double inheritance, so Uno derived fromToggleMenuFlyoutItemand shadowed itsIsCheckedwithnew. This PR matches the WinUI public base and duplicates the toggle behaviour that was previously inherited:RadioMenuFlyoutItem : MenuFlyoutItem(was: ToggleMenuFlyoutItem). The twin-IsCheckedsync dance (base.IsChecked↔ ownIsChecked,m_isSafeUncheck) is gone — there is now a singleIsChecked.ChangeVisualState— duplicated fromToggleMenuFlyoutItem, driving theCheckStates(Checked/Unchecked, +WithIcon) off the control's ownIsChecked.Invoke— a radio item is always checked on invocation and never toggled off by user interaction.HasToggle() => true— so the parentMenuFlyoutPresenterstill reserves the check column for radio-only menus (this was previously inherited fromToggleMenuFlyoutItem; the presenter decides column reservation via the polymorphicHasToggle(), not a type check).OnCreateAutomationPeerreturnsToggleMenuFlyoutItemAutomationPeer(matching WinUI's toggle automation surface). That peer gains aninternalMenuFlyoutItemconstructor and readsIsCheckedpolymorphically, so aRadioMenuFlyoutItemowner works.newremoved fromIsChecked/IsCheckedProperty(nothing to hide anymore).ControlTemplateretargets fromToggleMenuFlyoutItemtoRadioMenuFlyoutItem.RadioMenuFlyoutItementry is removed from_skipBaseTypes(the double-inheritance workaround); the generated stub now carries theMenuFlyoutItembase.Validation
SamplesApp.Skia.Generic(net10.0 Skia) builds clean (0 warnings / 0 errors), regenerating the merged theme XAML with the retargeted template.Given_RadioMenuFlyoutItem— 4/4 pass. The 3 existing group-semantics tests stay green (behaviour-preserving), plus a newWhen_AutomationPeer_Reports_Toggle_Statethat asserts the peer type,IToggleProvider.ToggleState, and that invoking viaToggle()checks the item and never toggles it off.Uno.WinAppSDKSyncGenerator(net11) are not built locally — CI validates them. A repo-wide grep confirmed nois/as ToggleMenuFlyoutItemsite actually receives aRadioMenuFlyoutItem.No
PackageDiffIgnore.xmlentries needed: base-type changes are untracked by the diff, and the declaredIsChecked/IsCheckedPropertysignatures are unchanged (droppingnewdoes not alter them).Note on
winappsdk-sync-check: the generated stub was hand-edited to add theMenuFlyoutItembase (matching theSplitMenuFlyoutItemformat), so the check should pass. If it reports drift, applying/apply-sync-genwill reconcile it.PR Checklist ✅
Given_RadioMenuFlyoutItem.When_AutomationPeer_Reports_Toggle_State, plus the existing suite as regression guards).Screenshots Compare Test Runresults — recommended, given the visual-state/template changes.Breaking change — impact & migration path
RadioMenuFlyoutItemno longer derives fromToggleMenuFlyoutItem. Code that treated aRadioMenuFlyoutItemas aToggleMenuFlyoutItem(assignment,is/as, casts) no longer compiles.RadioMenuFlyoutItem(or its now-direct baseMenuFlyoutItem) directly. ItsIsChecked,GroupName, andAreCheckStatesEnabledmembers are unchanged. This matches WinUI, whereRadioMenuFlyoutItem's public base isMenuFlyoutItem.