Skip to content

WinUI: Add MenuFlyout styling - #679

Merged
Anna Malchow-Perryman (apman) merged 5 commits into
masterfrom
agents/winui-menu-flyout-styling
Oct 2, 2026
Merged

Anna Malchow-Perryman (apman) merged 5 commits into
masterfrom
agents/winui-menu-flyout-styling

Conversation

@apman

Copy link
Copy Markdown
Contributor

Summary

  • Style WinUI MenuFlyout presenters, items, separators, submenu chevrons, surfaces/shadows, and directional entrance animations.
  • Recolour SVG icons for light/dark and disabled states, including submenu items.
  • Add classic and Mica resources, focused tests, and separate Windows visual baselines; document deferred solid-backdrop validation.

Validation

  • WinUI theme builds successfully.
  • 15 focused MenuFlyout/Mica unit tests pass.
  • Classic and Mica MenuFlyout visual regression cases pass separately.

Reviewer notes

  • WinUIMica is marked complete; WinUIClassic is marked needs validation against the native solid-backdrop/acrylic fallback. The SampleApp startup selection remains local and is not included in this PR.
    Posted by Copilot SDK in VS Code (agent), on behalf of Anna Malchow-Perryman (@apman).

Style MenuFlyout surfaces, items, submenus, SVG icons, and entrance motion for WinUI classic and Mica. Add focused behavior tests and separate Windows baselines; document pending classic validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 21:53

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

The catalog change enables Linux and macOS visual tests without providing their required MenuFlyout baselines.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Adds WinUI styling for MenuFlyout surfaces, items, icons, submenus, separators, and animations.

Changes:

  • Adds classic/Mica resources and complete MenuFlyout templates.
  • Adds entrance animations and SVG recolouring.
  • Adds focused tests, catalog status, and validation guidance.
File Description
WinUiMicaProbe.cs Tests Mica flyout resources.
WinUiMenuFlyoutTests.cs Tests icons, animations, shadows, and submenus.
ThemeRoot.axaml Loads scoped SVG styles.
README.md Documents classic/Mica validation.
MenuFlyoutSvg.styles.axaml Recolours SVG menu icons.
MenuFlyoutEntrance.cs Implements entrance animation behavior.
MenuFlyout.axaml Defines WinUI flyout control themes.
Controls/​_index.axaml Registers MenuFlyout resources.
ThemeResources.Windows11.axaml Adds translucent Mica surfaces.
ThemeResources.axaml Adds classic and state resources.
page-catalog.jsonc Enables WinUI visual-test discovery.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread samples/SampleApp/PageCatalog/page-catalog.jsonc

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Address the three moderate findings in the MenuFlyout template and SVG icon resources.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Comment thread src/Devolutions.AvaloniaTheme.WinUI/Controls/MenuFlyout.axaml Outdated
…adding

The main flyout surface hard-coded Padding="0,2" while the submenu
surface bound to the MenuFlyoutPresenterThemePadding dynamic resource.
Overriding that resource therefore only affected submenus, causing the
two surfaces to diverge. Bind both to the same resource.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 2, 2026 13:53

Copilot AI left a comment

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.

Copilot review overview

🔵 Needs a closer look

Bind the top-level MenuFlyout presenter’s MaxWidth and MinHeight constraints.

Review effort: Lite
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Bind MaxWidth and MinHeight on the outer flyout presenter

src/​Devolutions.AvaloniaTheme.WinUI/​Controls/​MenuFlyout.axaml:29

The outer presenter surface does not bind MaxWidth or MinHeight (unlike the submenu surface below at lines 126-127), so the inherited FlyoutThemeMaxWidth/MenuFlyoutThemeMinHeight constraints are ignored for top-level flyouts. Long menus can grow past the intended width, and short presenters do not receive the minimum height; bind these properties on LayoutRoot as well.

randy-but-a-ro[bot]
randy-but-a-ro Bot previously approved these changes Oct 2, 2026

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "3b226770-be69-11f1-86a4-087effde52b3",
	"headSha": "6511d2c2d1c78053f0be99ec524f417f5d0efca7",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

…surface

The outer flyout surface (LayoutRoot) did not bind MaxWidth/MinHeight, unlike
the submenu surface, so the inherited FlyoutThemeMaxWidth/MenuFlyoutThemeMinHeight
constraints were not applied to top-level flyouts (confirmed via a headless test:
the border''s MaxWidth read back as Infinity). Bind both on LayoutRoot and add
regression assertions to the existing shadow/padding/chevron test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@apman

Copy link
Copy Markdown
Contributor Author

Addressed the "previously missed" finding from the latest review (Bind MaxWidth and MinHeight on the outer flyout presenter, src/Devolutions.AvaloniaTheme.WinUI/Controls/MenuFlyout.axaml:29).

Fixed in 3acd95e: the outer MenuFlyoutPresenter's LayoutRoot border now also binds MaxWidth="{DynamicResource FlyoutThemeMaxWidth}" and MinHeight="{DynamicResource MenuFlyoutThemeMinHeight}", matching the submenu surface. I verified with a headless test that the border's MaxWidth previously read back as Infinity (the base theme's inherited setter for that property is not applied once the derived ControlTheme overrides the Template), and now correctly resolves to 456/32. Added regression assertions for both properties (on the outer surface and the submenu surface) to the existing Flyout_and_submenu_have_shadow_padding_and_small_chevron test; all 316 tests in the project pass.

Posted by Copilot SDK in VS Code (agent), on behalf of Anna Malchow-Perryman (@apman).

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Preserve presenter layout overrides and scope the Separator theme to MenuFlyout content.

Review effort: Lite
Findings: 1 Medium severity

Open (1)

Comment thread src/Devolutions.AvaloniaTheme.WinUI/Controls/MenuFlyout.axaml Outdated
…w through

Padding/MaxWidth/MinHeight were bound directly to theme resources on the
LayoutRoot border, bypassing the presenter''s own properties: a consumer
overriding MenuFlyoutPresenter.Padding/MaxWidth/MinHeight (per-instance or via
a style) was silently ignored by the rendered surface. Add ControlTheme
Setters with the resource-backed defaults and bind the template to those
properties via TemplateBinding instead, matching the established pattern in
the Linux theme''s MenuFlyoutPresenter. Added a regression test asserting
instance-level overrides reach the rendered border.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 2, 2026 14:32

Copilot AI left a comment

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.

Copilot review overview

🔵 Needs a closer look

Resolve the unscoped Separator style and duplicate submenu animation subscriptions.

Review effort: Lite
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Scope menu separator styling to MenuFlyout descendants

src/​Devolutions.AvaloniaTheme.WinUI/​Controls/​MenuFlyout.axaml:153

This adds an implicit {x:Type Separator} theme to the WinUI theme, so every Separator in the consuming scope—including ordinary panels and SeparatorDemo—will receive MenuFlyout's 1px height and 12,4 margin. The repository explicitly guards against this pattern because menu separator styling must be scoped to menu descendants (tests/Devolutions.AvaloniaControls.Tests/MenuPackContractTests.cs:597-650). Use a selector style scoped to MenuFlyoutPresenter/nested MenuItem descendants instead.

randy-but-a-ro[bot]
randy-but-a-ro Bot previously approved these changes Oct 2, 2026

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "c7694140-be6e-11f1-8cad-a94a7234324a",
	"headSha": "7dd83f6aa0412fdf6e5d9609e983b292af31f7b5",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

The implicit `{x:Type Separator}` ControlTheme in MenuFlyout.axaml restyled
every Separator in the consuming app (e.g. SampleApp''s standalone
SeparatorDemo, which the page catalog marks as not yet supported by WinUI),
not just the ones inside menus, mirroring a regression the Linux/macOS/
DevExpress themes already guard against (MenuPackContractTests.cs).

Move the separator styling into a new scoped Controls/MenuFlyoutSeparator.
styles.axaml using a descendant selector (ContextMenu/MenuFlyoutPresenter/
Menu/MenuItem Separator), matching the sibling themes'' convention, and merge
it via StyleInclude in ThemeRoot.axaml. Added a regression test asserting a
standalone Separator keeps its Fluent-default Background while one inside a
MenuFlyoutPresenter gets the WinUI value.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 2, 2026 14:54
@apman

Copy link
Copy Markdown
Contributor Author

Addressed the "previously missed" finding from the latest review (Scope menu separator styling to MenuFlyout descendants, src/Devolutions.AvaloniaTheme.WinUI/Controls/MenuFlyout.axaml:153).

Fixed in f208be7: removed the implicit {x:Type Separator} ControlTheme (which restyled every Separator in the consuming app, not just menu ones) and moved the styling into a new Controls/MenuFlyoutSeparator.styles.axaml using a descendant selector (ContextMenu Separator, MenuFlyoutPresenter Separator, Menu Separator, MenuItem Separator), merged via StyleInclude in ThemeRoot.axaml. This matches the convention already established by the Linux/macOS/DevExpress themes' own Separator.styles.axaml and the regression guard in MenuPackContractTests.cs. Added a test (Separator_styling_is_scoped_to_menu_descendants) asserting a standalone Separator keeps Fluent's default Background while one inside a MenuFlyoutPresenter gets the WinUI value. Full test suite (318 tests) passes.
Posted by Copilot SDK in VS Code (agent), on behalf of Anna Malchow-Perryman (@apman).

Copilot AI left a comment

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.

Copilot review overview

🔵 Needs a closer look

Isolate separator styling and serialize access to the process-wide Mica test override.

Review effort: Lite
Findings: None

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "fc86f180-be71-11f1-8e83-9d86a9f40e91",
	"headSha": "f208be7a821895d1d573d558acf1f57e4ae6d03b",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@apman
Anna Malchow-Perryman (apman) merged commit 5ae732b into master Oct 2, 2026
1 check passed
@apman
Anna Malchow-Perryman (apman) deleted the agents/winui-menu-flyout-styling branch October 2, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants