Skip to content

refactor(controls)!: Reparent RadioMenuFlyoutItem to MenuFlyoutItem (BC52) - #23749

Merged
Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc52-radiomenuflyoutitem-reparent
Jul 20, 2026
Merged

Xiaoy312 merged 1 commit into
feature/breakingchangesfrom
dev/xygu/20260713/bc52-radiomenuflyoutitem-reparent

Conversation

@Xiaoy312

Copy link
Copy Markdown
Contributor

GitHub Issue: #8339

PR Type:

💬 Other... Breaking change (API alignment with WinUI)

What changed? 🚀

Reparents RadioMenuFlyoutItem from ToggleMenuFlyoutItem to MenuFlyoutItem (BC52 of the Phase 5 breaking-changes wave).

WinUI derives RadioMenuFlyoutItem publicly from MenuFlyoutItem while secretly reusing ToggleMenuFlyoutItem. C# has no such double inheritance, so Uno derived from ToggleMenuFlyoutItem and shadowed its IsChecked with new. This PR matches the WinUI public base and duplicates the toggle behaviour that was previously inherited:

  • Base: RadioMenuFlyoutItem : MenuFlyoutItem (was : ToggleMenuFlyoutItem). The twin-IsChecked sync dance (base.IsChecked ↔ own IsChecked, m_isSafeUncheck) is gone — there is now a single IsChecked.
  • ChangeVisualState — duplicated from ToggleMenuFlyoutItem, driving the CheckStates (Checked/Unchecked, +WithIcon) off the control's own IsChecked.
  • Invoke — a radio item is always checked on invocation and never toggled off by user interaction.
  • HasToggle() => true — so the parent MenuFlyoutPresenter still reserves the check column for radio-only menus (this was previously inherited from ToggleMenuFlyoutItem; the presenter decides column reservation via the polymorphic HasToggle(), not a type check).
  • Automation — OnCreateAutomationPeer returns ToggleMenuFlyoutItemAutomationPeer (matching WinUI's toggle automation surface). That peer gains an internal MenuFlyoutItem constructor and reads IsChecked polymorphically, so a RadioMenuFlyoutItem owner works.
  • new removed from IsChecked/IsCheckedProperty (nothing to hide anymore).
  • Default template — the ControlTemplate retargets from ToggleMenuFlyoutItem to RadioMenuFlyoutItem.
  • Sync generator — the RadioMenuFlyoutItem entry is removed from _skipBaseTypes (the double-inheritance workaround); the generated stub now carries the MenuFlyoutItem base.

Validation

  • Compile: SamplesApp.Skia.Generic (net10.0 Skia) builds clean (0 warnings / 0 errors), regenerating the merged theme XAML with the retargeted template.
  • Runtime (Skia Desktop): Given_RadioMenuFlyoutItem — 4/4 pass. The 3 existing group-semantics tests stay green (behaviour-preserving), plus a new When_AutomationPeer_Reports_Toggle_State that asserts the peer type, IToggleProvider.ToggleState, and that invoking via Toggle() checks the item and never toggles it off.
  • Native Android/iOS heads and the Uno.WinAppSDKSyncGenerator (net11) are not built locally — CI validates them. A repo-wide grep confirmed no is/as ToggleMenuFlyoutItem site actually receives a RadioMenuFlyoutItem.

No PackageDiffIgnore.xml entries needed: base-type changes are untracked by the diff, and the declared IsChecked/IsCheckedProperty signatures are unchanged (dropping new does not alter them).

Note on winappsdk-sync-check: the generated stub was hand-edited to add the MenuFlyoutItem base (matching the SplitMenuFlyoutItem format), so the check should pass. If it reports drift, applying /apply-sync-gen will reconcile it.

PR Checklist ✅

  • 🧪 Added Runtime tests — done (Given_RadioMenuFlyoutItem.When_AutomationPeer_Reports_Toggle_State, plus the existing suite as regression guards).
  • 📚 Docs added/updated — N/A (migration note below).
  • 🖼️ Validated PR Screenshots Compare Test Run results — recommended, given the visual-state/template changes.
  • ❗ Contains NO breaking changes — intentionally left unchecked; this is a breaking change (see below).
  • 👀 Reviewed 2 other open pull requests

Breaking change — impact & migration path

  • Impact (source-breaking): RadioMenuFlyoutItem no longer derives from ToggleMenuFlyoutItem. Code that treated a RadioMenuFlyoutItem as a ToggleMenuFlyoutItem (assignment, is/as, casts) no longer compiles.
  • Migration: use RadioMenuFlyoutItem (or its now-direct base MenuFlyoutItem) directly. Its IsChecked, GroupName, and AreCheckStatesEnabled members are unchanged. This matches WinUI, where RadioMenuFlyoutItem's public base is MenuFlyoutItem.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222149 found UI Test snapshots differences: skia-linux-screenshots: 68, skia-windows-screenshots: 77

Details
  • skia-linux-screenshots: 68 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • DropDownButtonPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • Image_Margin_Large.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CornerRadiusControls.png
    • ElementLevelTheme.png-dark
    • Gamepad_Enumeration.png-dark
    • ColorPickerSample.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • CompositionPath.png
    • DoubleImageBrushInList.png-dark
  • skia-windows-screenshots: 77 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gamepad_Enumeration.png-dark
    • Basics Pivot Test.png
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • ClipboardTests.png-dark
    • DropDownButtonPage.png-dark
    • DisplayInformation.png-dark
    • DropDownButtonPage.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • ImageBrushInList.png-dark
    • Image_UseTargetSize.png
    • ImageBrushInList.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • ImageSourceUrlMsAppDataScheme.png

…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]>
@Xiaoy312
Xiaoy312 force-pushed the dev/xygu/20260713/bc52-radiomenuflyoutitem-reparent branch from 8f42956 to d15c582 Compare July 15, 2026 19:28
@Xiaoy312
Xiaoy312 enabled auto-merge July 15, 2026 19:28
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222538 found UI Test snapshots differences: skia-linux-screenshots: 65, skia-windows-screenshots: 75

Details
  • skia-linux-screenshots: 65 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • DropDownButtonPage.png-dark
    • CalendarView_Theming.png-dark
    • DisplayInformation.png-dark
    • BitmapIcon_Foreground.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • Focus_FocusVisual_Properties.png-dark
    • ElementLevelTheme.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • Buttons.png-dark
    • Buttons.png
    • ImageIconPage.png-dark
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Image_AnimatedWebP.png-dark
  • skia-windows-screenshots: 75 changed over 2368

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DisplayInformation.png-dark
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ClipboardTests.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Gamepad_Enumeration.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • Image_UseTargetSize.png-dark
    • DropDownButtonPage.png-dark
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Buttons.png-dark
    • Buttons.png
    • DoubleImageBrushInList.png-dark

@Xiaoy312
Xiaoy312 merged commit ceb8f11 into feature/breakingchanges Jul 20, 2026
50 checks passed
@Xiaoy312
Xiaoy312 deleted the dev/xygu/20260713/bc52-radiomenuflyoutitem-reparent branch July 20, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants