Skip to main content

SmoothScrollViewer

Description​

SmoothScrollViewer hosts content with Fluent scrolling behavior and themed scrollbars.

Use it for scrollable content that should use Fluence scrolling visuals.

Constrained SmoothScrollViewer before scrolling in light mode Constrained SmoothScrollViewer before scrolling in dark mode

After scrolling​

The lower items come into view and the scrollbar indicator appears at the right edge.

SmoothScrollViewer after scrolling in light mode SmoothScrollViewer after scrolling in dark mode

Example usage​

<fluence:SmoothScrollViewer Height="220">
<StackPanel Height="500">
<TextBlock Text="Top of the content" />
<TextBlock Margin="0,450,0,0" Text="Bottom of the content" />
</StackPanel>
</fluence:SmoothScrollViewer>

Key properties​

PropertyDefaultPurpose
ScrollDuration250 msDuration of a smooth scroll animation.
ContentnullContent presented in the scrolling viewport.

State and behavior​

Scrolling changes the viewport while retaining Fluent scrollbar presentation.

Parts​

ScrollBarExtensions​

Description​

ScrollBarExtensions adds indicator behavior to native WPF ScrollBar. The screenshots show ScrollBarExtensions inside SmoothScrollViewer.

The gallery scroll viewer enables the indicator behavior through its internal scrollbar template. The parent captures above show its vertical scrollbar before and after scrolling, with the indicator visible.

See the parent control captures above for this part in context.

After scrolling​

See the parent control captures above for this part in context.

Example usage​

<fluence:SmoothScrollViewer Height="160">
<StackPanel Height="500">
<TextBlock Text="Top" />
<TextBlock Margin="0,450,0,0" Text="Bottom" />
</StackPanel>
</fluence:SmoothScrollViewer>

The Fluence scroll viewer template applies ScrollBarExtensions.IsIndicatorEnabled to its internal scroll bars. A custom scrollbar can set that attached property only when its template supports the Fluence indicator states. A standalone bar has no scroll viewer host and stays visible.

State and behavior​

Attached indicator settings alter the native ScrollBar's indicator presentation during interaction.

Reference​

Events​

ScrollChanged reports scrolling and viewport changes.

Reference​