Browse Source

Hide the spurious menu scroll chevrons on Simple theme

The Simple theme's SimpleMenuScrollViewer template wraps menu items
in a ScrollViewer whose Top / Bottom docked RepeatButtons are the
classic Win9x scroll chevrons. Their IsVisible binding feeds through
MenuScrollingVisibilityConverter which does an AreClose check on
Extent vs Viewport. At any non-100% DPI scale (125%, 150%, ...) the
layout-rounding pass leaves a small gap so AreClose returns false
and the converter declares "content overflows," then both chevrons
render even when the menu only has two items and obviously fits.

Bug tracked upstream as AvaloniaUI/Avalonia#9501; the partial fix in
PR #11916 (ScrollContentPresenter rounding) is already in 12.0.3 but
doesn't widen the converter's tolerance, so the symptom persists.

Hide both chevrons unconditionally inside any menu's scroll viewer.
Safe because: (a) the popup positioner already clamps menu height to
the available screen area, and (b) ILSpy's menus are short enough
that real overflow doesn't occur on any sane display. Height = 0
collapses the DockPanel slot the chevrons would otherwise reserve
before the visibility binding propagates.

Two selectors (MenuFlyoutPresenter and ContextMenu) cover both
managed-menu paths; the inline NativeMenuBar on Linux / Windows
routes through the same SimpleMenuScrollViewer template, so the
top-level menus pick this up too.

Assisted-by: Claude:claude-opus-4-7:Claude Code
pull/3755/head
Siegfried Pammer 1 month ago
parent
commit
3bebaaec7a
  1. 20
      ILSpy/App.axaml

20
ILSpy/App.axaml

@ -134,6 +134,26 @@ @@ -134,6 +134,26 @@
<Setter Property="Background" Value="Gray" />
</Style>
<!-- Suppress upstream Simple-theme menu scroll chevrons (the two RepeatButtons
docked Top/Bottom inside the SimpleMenuScrollViewer template). Their
IsVisible binding feeds through MenuScrollingVisibilityConverter, which
does an AreClose comparison on Extent vs Viewport; at non-100% DPI
scaling the layout-rounding leaves a tiny gap so the converter returns
true and the chevrons render even when content fits the popup. Bug
tracked upstream as AvaloniaUI/Avalonia#9501. Hiding unconditionally is
safe because the popup positioner already clamps menu height to screen
bounds, and ILSpy's menus are all small enough to fit without scrolling.
Height = 0 collapses the DockPanel slot the buttons would otherwise
reserve before the visibility flip propagates. -->
<Style Selector="MenuFlyoutPresenter /template/ ScrollViewer /template/ RepeatButton">
<Setter Property="IsVisible" Value="False" />
<Setter Property="Height" Value="0" />
</Style>
<Style Selector="ContextMenu /template/ ScrollViewer /template/ RepeatButton">
<Setter Property="IsVisible" Value="False" />
<Setter Property="Height" Value="0" />
</Style>
<!-- VS-style preview tab: italicise the title of any DocumentTabStripItem whose
dockable is a ContentTabPage with IsPreview=true. Tool-pane tabs and pinned
document tabs fall through to Normal via the converter's null/false branch.

Loading…
Cancel
Save