Skip to content

ScrollArea

ScrollArea derives directly from the native ScrollViewer and is re-templated with overlay scrollbars, inheriting native keyboard scrolling, mouse-wheel handling, and ScrollPattern automation support for free through standard part names. IsHovering and IsScrolling mirror the web contract’s hover/scroll fade state so the template can show and hide the bars without a hand-rolled state machine.

xmlns:navius="clr-namespace:Navius.Wpf.Primitives.Controls;assembly=Navius.Wpf.Primitives"
<navius:NaviusScrollArea ScrollHideDelay="600">
<StackPanel>
<!-- long content -->
</StackPanel>
</navius:NaviusScrollArea>
Property Type Default From Description
IsHovering bool false NaviusScrollArea Read-only. true while the pointer is over the scroll area (real-time, no delay), driven by OnMouseEnter/OnMouseLeave.
IsScrolling bool false NaviusScrollArea Read-only. true while a scroll is in progress or within ScrollHideDelay milliseconds of the last one; reset by an internal DispatcherTimer.
ScrollHideDelay int 600 NaviusScrollArea Milliseconds of scroll inactivity before IsScrolling resets to false.
Content object - ScrollViewer The scrollable content.
Key Behavior
Arrow keys / Page Up / Page Down / Home / End Native ScrollViewer keyboard scrolling, inherited unchanged; NaviusScrollArea intercepts no keys itself.

NaviusScrollArea ships no custom AutomationPeer and inherits the native ScrollViewerAutomationPeer (reports AutomationControlType.Pane and implements ScrollPattern) through the standard PART_ScrollContentPresenter/PART_VerticalScrollBar/ PART_HorizontalScrollBar part names declared in Themes/ScrollArea.xaml, so no OnApplyTemplate override was needed. The re-templated ScrollBar parts carry their own native ScrollBarAutomationPeer. The unit suite (ScrollAreaTests) verifies the IsHovering/IsScrolling state transitions, the ScrollHideDelay timer, and that the applied template exposes PART_ScrollContentPresenter/PART_VerticalScrollBar/PART_HorizontalScrollBar/ PART_Corner by name.

  • The web family renders five separate parts (Root/Viewport/Scrollbar/Thumb/Corner) as plain divs with no ARIA roles at all; the WPF port collapses them onto one ScrollViewer-derived control plus its ControlTemplate. The native ScrollViewerAutomationPeer/ ScrollBarAutomationPeer pair is a strict accessibility upgrade over that ARIA-free baseline, not a gap.
  • Thumb size/offset ratio math (ThumbSizeRatio/ThumbOffsetRatio, hand-rolled in the web’s JS) is not ported; the re-templated native ScrollBar’s own Track computes thumb geometry from TemplateBindings onto Value/Maximum/ViewportSize instead.
  • The pointer-drag thumb gesture (a JS dragScrollThumb module on the web) is not ported; the native Thumb/Track drag-to-scroll behavior supersedes it entirely, including RTL handling (WPF’s FlowDirection is the framework-level RTL mechanism, not the web’s manual sign-flip).
  • Type (auto/always/hover/scroll scrollbar-visibility mode) is not ported as a discrete property; only the hover/scroll fade behavior is implemented via IsHovering/IsScrolling triggers, with bar presence governed by native ScrollBarVisibility instead.
  • ForceMount (keep a scrollbar mounted with no overflow) has no WPF equivalent property; Visibility is the only presence control.
  • Dir/RTL thumb-offset sign-flip normalization is dropped; WPF’s FlowDirection already handles RTL layout at the framework level.
  • M6 audit found no confirmed or plausible defects; the smaller ported surface (no Type, no ForceMount) is a deliberate scope reduction, not a behavioral gap.

The ScrollArea Gallery page rendered at the pinned commit, in each theme.

ScrollArea Gallery page in the light theme

ScrollArea Gallery page in the dark theme

ScrollArea Gallery page in the high contrast theme