Show / Hide Table of Contents

Class ScrollViewer

Represents a scrollable area that can contain other visible elements.

Inheritance
System.Object
DependencyObject
UIElement
FrameworkElement
Control
ContentControl
ScrollViewer
Inherited Members
ContentControl.Content
ContentControl.ContentProperty
ContentControl.ContentTemplate
ContentControl.ContentTemplateProperty
ContentControl.OnContentChanged(Object, Object)
ContentControl.LogicalChildren
Control.EnableBaseControlHandlingOfVisualStates
Control.ManageIsEnabled(Boolean)
Control.Background
Control.BackgroundProperty
Control.BorderBrush
Control.BorderBrushProperty
Control.BorderThickness
Control.BorderThicknessProperty
Control.FontWeight
Control.FontWeightProperty
Control.FontStyle
Control.FontStyleProperty
Control.Foreground
Control.ForegroundProperty
Control.FontFamily
Control.FontFamilyProperty
Control.FontSize
Control.FontSizeProperty
Control.TextDecorations
Control.TextDecorationsProperty
Control.Padding
Control.PaddingProperty
Control.HorizontalContentAlignment
Control.HorizontalContentAlignmentProperty
Control.VerticalContentAlignment
Control.VerticalContentAlignmentProperty
Control.TabIndex
Control.TabIndexProperty
Control.IsTabStop
Control.IsTabStopProperty
Control.TabNavigation
Control.TabNavigationProperty
Control.Template
Control.TemplateProperty
Control.ApplyTemplate()
Control.GetTemplateChild(String)
Control.Focus()
Control.HandlesScrolling
Control.OnGotFocus(RoutedEventArgs)
Control.OnLostFocus(RoutedEventArgs)
Control.CreateDomElement(Object, Object)
Control.CharacterSpacingProperty
Control.CharacterSpacing
Control.FontStretchProperty
Control.FontStretch
Control.OnDrop(DragEventArgs)
Control.OnDragEnter(DragEventArgs)
Control.OnDragLeave(DragEventArgs)
Control.OnTextInputUpdate(TextCompositionEventArgs)
FrameworkElement.LayoutUpdated
FrameworkElement.SizeChanged
FrameworkElement.ResourceLookupMode
FrameworkElement.StyleProperty
FrameworkElement.Style
FrameworkElement.DefaultStyleKeyProperty
FrameworkElement.DefaultStyleKey
FrameworkElement.OverridesDefaultStyleProperty
FrameworkElement.OverridesDefaultStyle
FrameworkElement.OnVisualParentChanged(DependencyObject)
FrameworkElement.VisualChildrenCount
FrameworkElement.GetVisualChild(Int32)
FrameworkElement.Parent
FrameworkElement.AddLogicalChild(Object)
FrameworkElement.RemoveLogicalChild(Object)
FrameworkElement.TemplatedParent
FrameworkElement.Resources
FrameworkElement.IsLoaded
FrameworkElement.SetBinding(DependencyProperty, BindingBase)
FrameworkElement.SetBinding(DependencyProperty, Binding)
FrameworkElement.GetBindingExpression(DependencyProperty)
FrameworkElement.Cursor
FrameworkElement.CursorProperty
FrameworkElement.FindName(String)
FrameworkElement.Name
FrameworkElement.NameProperty
FrameworkElement.DataContext
FrameworkElement.DataContextProperty
FrameworkElement.DataContextChanged
FrameworkElement.Triggers
FrameworkElement.FlowDirectionProperty
FrameworkElement.FlowDirection
FrameworkElement.LanguageProperty
FrameworkElement.Language
FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs)
FrameworkElement.Tag
FrameworkElement.TagProperty
FrameworkElement.LoadedEvent
FrameworkElement.Loaded
FrameworkElement.Unloaded
FrameworkElement.BindingValidationError
FrameworkElement.ContextMenuProperty
FrameworkElement.ContextMenu
FrameworkElement.ContextMenuOpening
FrameworkElement.ToolTipProperty
FrameworkElement.ToolTip
FrameworkElement.INTERNAL_OnDetachedFromVisualTree()
FrameworkElement.INTERNAL_OnAttachedToVisualTree()
FrameworkElement.Height
FrameworkElement.HeightProperty
FrameworkElement.Width
FrameworkElement.WidthProperty
FrameworkElement.HorizontalAlignment
FrameworkElement.HorizontalAlignmentProperty
FrameworkElement.VerticalAlignment
FrameworkElement.VerticalAlignmentProperty
FrameworkElement.Margin
FrameworkElement.MarginProperty
FrameworkElement.MinHeight
FrameworkElement.MinHeightProperty
FrameworkElement.MinWidth
FrameworkElement.MinWidthProperty
FrameworkElement.MaxHeight
FrameworkElement.MaxHeightProperty
FrameworkElement.MaxWidth
FrameworkElement.MaxWidthProperty
FrameworkElement.ActualWidthProperty
FrameworkElement.ActualWidth
FrameworkElement.ActualHeightProperty
FrameworkElement.ActualHeight
UIElement.TransformToVisual(UIElement)
UIElement.RenderSize
UIElement.DesiredSize
UIElement.InvalidateMeasure()
UIElement.InvalidateArrange()
UIElement.Measure(Size)
UIElement.Arrange(Rect)
UIElement.UpdateLayout()
UIElement.DragEnter
UIElement.DragLeave
UIElement.Drop
UIElement.DragOver
UIElement.CacheMode
UIElement.CacheModeProperty
UIElement.Projection
UIElement.ProjectionProperty
UIElement.VisualParent
UIElement.AddVisualChild(UIElement)
UIElement.RemoveVisualChild(UIElement)
UIElement.OnVisualChildrenChanged(DependencyObject, DependencyObject)
UIElement.XamlSourcePath
UIElement.ClipToBounds
UIElement.ClipToBoundsProperty
UIElement.ClipProperty
UIElement.Clip
UIElement.IsEnabledProperty
UIElement.IsEnabled
UIElement.IsEnabledChanged
UIElement.EffectProperty
UIElement.Effect
UIElement.RenderTransformProperty
UIElement.RenderTransform
UIElement.RenderTransformOriginProperty
UIElement.RenderTransformOrigin
UIElement.UseLayoutRounding
UIElement.UseLayoutRoundingProperty
UIElement.Visibility
UIElement.VisibilityProperty
UIElement.IsVisibleProperty
UIElement.IsVisible
UIElement.IsVisibleChanged
UIElement.OpacityProperty
UIElement.Opacity
UIElement.OpacityMaskProperty
UIElement.OpacityMask
UIElement.IsHitTestVisible
UIElement.IsHitTestVisibleProperty
UIElement.AllowDrop
UIElement.AllowDropProperty
UIElement.CaptureMouse()
UIElement.IsMouseCaptured
UIElement.ReleaseMouseCapture()
UIElement.AllowScrollOnTouchMove
UIElement.AllowScrollOnTouchMoveProperty
UIElement.AddHandler(RoutedEvent, Delegate, Boolean)
UIElement.RemoveHandler(RoutedEvent, Delegate)
UIElement.MouseMoveEvent
UIElement.MouseMove
UIElement.MouseLeftButtonDownEvent
UIElement.MouseLeftButtonDown
UIElement.MouseRightButtonDownEvent
UIElement.MouseRightButtonDown
UIElement.OnMouseRightButtonDown(MouseButtonEventArgs)
UIElement.MouseWheelEvent
UIElement.MouseWheel
UIElement.MouseLeftButtonUpEvent
UIElement.MouseLeftButtonUp
UIElement.MouseEnterEvent
UIElement.MouseEnter
UIElement.OnMouseEnter(MouseEventArgs)
UIElement.MouseLeaveEvent
UIElement.MouseLeave
UIElement.OnMouseLeave(MouseEventArgs)
UIElement.TextInputStartEvent
UIElement.TextInputStart
UIElement.OnTextInputStart(TextCompositionEventArgs)
UIElement.TextInputEvent
UIElement.TextInput
UIElement.OnTextInput(TextCompositionEventArgs)
UIElement.TextInputUpdateEvent
UIElement.TextInputUpdate
UIElement.TappedEvent
UIElement.Tapped
UIElement.OnTapped(TappedRoutedEventArgs)
UIElement.MouseRightButtonUpEvent
UIElement.MouseRightButtonUp
UIElement.OnMouseRightButtonUp(MouseButtonEventArgs)
UIElement.KeyDownEvent
UIElement.KeyDown
UIElement.KeyUpEvent
UIElement.KeyUp
UIElement.OnKeyUp(KeyEventArgs)
UIElement.GotFocusEvent
UIElement.GotFocus
UIElement.LostFocusEvent
UIElement.LostFocus
UIElement.LostMouseCapture
UIElement.OnLostMouseCapture(MouseEventArgs)
UIElement.INTERNAL_AttachToDomEvents()
UIElement.INTERNAL_DetachFromDomEvents()
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
[TemplatePart(Name = "ScrollContentPresenter", Type = typeof(ScrollContentPresenter))]
[TemplatePart(Name = "HorizontalScrollBar", Type = typeof(ScrollBar))]
[TemplatePart(Name = "VerticalScrollBar", Type = typeof(ScrollBar))]
public sealed class ScrollViewer : ContentControl, IControl, IFrameworkElement, IUIElement, IDependencyObject

Constructors

| Improve this Doc View Source

ScrollViewer()

Initializes a new instance of the ScrollViewer class.

Declaration
public ScrollViewer()

Fields

| Improve this Doc View Source

ComputedHorizontalScrollBarVisibilityProperty

Identifies the ComputedHorizontalScrollBarVisibility dependency property.

Declaration
public static readonly DependencyProperty ComputedHorizontalScrollBarVisibilityProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ComputedVerticalScrollBarVisibilityProperty

Identifies the ComputedVerticalScrollBarVisibility dependency property.

Declaration
public static readonly DependencyProperty ComputedVerticalScrollBarVisibilityProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ExtentHeightProperty

Identifier for the ExtentHeight dependency property.

Declaration
public static readonly DependencyProperty ExtentHeightProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ExtentWidthProperty

Identifier for the ExtentWidth dependency property.

Declaration
public static readonly DependencyProperty ExtentWidthProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

HorizontalOffsetProperty

Identifies the HorizontalOffset dependency property.

Declaration
public static readonly DependencyProperty HorizontalOffsetProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

HorizontalScrollBarVisibilityProperty

Identifies the HorizontalScrollBarVisibility dependency property.

Declaration
public static readonly DependencyProperty HorizontalScrollBarVisibilityProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ScrollableHeightProperty

Identifies the ScrollableHeight dependency property.

Declaration
public static readonly DependencyProperty ScrollableHeightProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ScrollableWidthProperty

Identifies the ScrollableWidth dependency property.

Declaration
public static readonly DependencyProperty ScrollableWidthProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

VerticalOffsetProperty

Identifies the VerticalOffset dependency property.

Declaration
public static readonly DependencyProperty VerticalOffsetProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

VerticalScrollBarVisibilityProperty

Identifies the VerticalScrollBarVisibility dependency property.

Declaration
public static readonly DependencyProperty VerticalScrollBarVisibilityProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ViewportHeightProperty

Identifies the ViewportHeight dependency property.

Declaration
public static readonly DependencyProperty ViewportHeightProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ViewportWidthProperty

Identifies the ViewportWidth dependency property.

Declaration
public static readonly DependencyProperty ViewportWidthProperty
Field Value
Type Description
DependencyProperty

Properties

| Improve this Doc View Source

ComputedHorizontalScrollBarVisibility

Gets a value that indicates whether the horizontal ScrollBar is visible.

Declaration
public Visibility ComputedHorizontalScrollBarVisibility { get; }
Property Value
Type Description
Visibility

A Visibility that indicates whether the horizontal scroll bar is visible. The default value is Visible.

| Improve this Doc View Source

ComputedVerticalScrollBarVisibility

Gets a value that indicates whether the vertical ScrollBar is visible.

Declaration
public Visibility ComputedVerticalScrollBarVisibility { get; }
Property Value
Type Description
Visibility

A Visibility that indicates whether the vertical scroll bar is visible. The default value is Visible.

| Improve this Doc View Source

ExtentHeight

Gets the vertical size of all the content for display in the ScrollViewer.

Declaration
public double ExtentHeight { get; }
Property Value
Type Description
System.Double

The vertical size of all the content for display in the ScrollViewer.

| Improve this Doc View Source

ExtentWidth

Gets the horizontal size of all the content for display in the ScrollViewer.

Declaration
public double ExtentWidth { get; }
Property Value
Type Description
System.Double

The horizontal size of all the content for display in the ScrollViewer.

| Improve this Doc View Source

HorizontalOffset

Gets a value that contains the horizontal offset of the scrolled content.

Declaration
public double HorizontalOffset { get; }
Property Value
Type Description
System.Double

The horizontal offset of the scrolled content. The default value is 0.0.

| Improve this Doc View Source

HorizontalScrollBarVisibility

Gets or sets a value that indicates whether a horizontal ScrollBar should be displayed.

Declaration
public ScrollBarVisibility HorizontalScrollBarVisibility { get; set; }
Property Value
Type Description
ScrollBarVisibility

A ScrollBarVisibility value that indicates whether a horizontal ScrollBar should be displayed. The default value is Hidden.

| Improve this Doc View Source

ScrollableHeight

Gets a value that represents the vertical size of the area that can be scrolled; the difference between the height of the extent and the height of the viewport.

Declaration
public double ScrollableHeight { get; }
Property Value
Type Description
System.Double

The vertical size of the area that can be scrolled. This property has no default value.

| Improve this Doc View Source

ScrollableWidth

Gets a value that represents the horizontal size of the area that can be scrolled; the difference between the width of the extent and the width of the viewport.

Declaration
public double ScrollableWidth { get; }
Property Value
Type Description
System.Double

The horizontal size of the area that can be scrolled. This property has no default value.

| Improve this Doc View Source

VerticalOffset

Gets a value that contains the vertical offset of the scrolled content.

Declaration
public double VerticalOffset { get; }
Property Value
Type Description
System.Double

The vertical offset of the scrolled content. The default value is 0.0.

| Improve this Doc View Source

VerticalScrollBarVisibility

Gets or sets a value that indicates whether a vertical ScrollBar should be displayed.

Declaration
public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }
Property Value
Type Description
ScrollBarVisibility

A ScrollBarVisibility value that indicates whether a vertical ScrollBar should be displayed. The default value is Visible.

| Improve this Doc View Source

ViewportHeight

Gets a value that contains the vertical size of the viewable content.

Declaration
public double ViewportHeight { get; }
Property Value
Type Description
System.Double

The vertical size of the viewable content. This property has no default value.

| Improve this Doc View Source

ViewportWidth

Gets a value that contains the horizontal size of the viewable content.

Declaration
public double ViewportWidth { get; }
Property Value
Type Description
System.Double

The horizontal size of the viewable content. The default value is 0.0.

Methods

| Improve this Doc View Source

ArrangeOverride(Size)

Declaration
protected override Size ArrangeOverride(Size arrangeSize)
Parameters
Type Name Description
Size arrangeSize
Returns
Type Description
Size
Overrides
Control.ArrangeOverride(Size)
| Improve this Doc View Source

GetHorizontalScrollBarVisibility(DependencyObject)

Gets the value of the HorizontalScrollBarVisibility dependency property from a specified element.

Declaration
public static ScrollBarVisibility GetHorizontalScrollBarVisibility(DependencyObject element)
Parameters
Type Name Description
DependencyObject element

The element from which the property value is read.

Returns
Type Description
ScrollBarVisibility

The value of the HorizontalScrollBarVisibility dependency property.

Exceptions
Type Condition
System.ArgumentNullException

element is null.

| Improve this Doc View Source

GetVerticalScrollBarVisibility(DependencyObject)

Gets the value of the VerticalScrollBarVisibility dependency property from a specified element.

Declaration
public static ScrollBarVisibility GetVerticalScrollBarVisibility(DependencyObject element)
Parameters
Type Name Description
DependencyObject element

The element from which the property value is read.

Returns
Type Description
ScrollBarVisibility

The value of the VerticalScrollBarVisibility dependency property.

Exceptions
Type Condition
System.ArgumentNullException

element is null.

| Improve this Doc View Source

InvalidateScrollInfo()

Called when the value of properties that describe the size and location of the scroll area change.

Declaration
public void InvalidateScrollInfo()
| Improve this Doc View Source

MeasureOverride(Size)

Declaration
protected override Size MeasureOverride(Size constraint)
Parameters
Type Name Description
Size constraint
Returns
Type Description
Size
Overrides
Control.MeasureOverride(Size)
| Improve this Doc View Source

OnApplyTemplate()

Declaration
public override void OnApplyTemplate()
Overrides
Control.OnApplyTemplate()
| Improve this Doc View Source

OnCreateAutomationPeer()

Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type Description
AutomationPeer
Overrides
UIElement.OnCreateAutomationPeer()
| Improve this Doc View Source

OnKeyDown(KeyEventArgs)

Responds to the KeyDown event.

Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type Name Description
KeyEventArgs e

Provides data for KeyEventArgs.

Overrides
UIElement.OnKeyDown(KeyEventArgs)
| Improve this Doc View Source

OnMouseLeftButtonDown(MouseButtonEventArgs)

Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type Name Description
MouseButtonEventArgs e
Overrides
UIElement.OnMouseLeftButtonDown(MouseButtonEventArgs)
| Improve this Doc View Source

OnMouseLeftButtonUp(MouseButtonEventArgs)

Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type Name Description
MouseButtonEventArgs e
Overrides
UIElement.OnMouseLeftButtonUp(MouseButtonEventArgs)
| Improve this Doc View Source

OnMouseMove(MouseEventArgs)

Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type Name Description
MouseEventArgs e
Overrides
UIElement.OnMouseMove(MouseEventArgs)
| Improve this Doc View Source

OnMouseWheel(MouseWheelEventArgs)

Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type Name Description
MouseWheelEventArgs e
Overrides
UIElement.OnMouseWheel(MouseWheelEventArgs)
| Improve this Doc View Source

ScrollToHorizontalOffset(Double)

Scrolls the content that is within the ScrollViewer to the specified horizontal offset position.

Declaration
public void ScrollToHorizontalOffset(double offset)
Parameters
Type Name Description
System.Double offset

The position that the content scrolls to.

| Improve this Doc View Source

ScrollToVerticalOffset(Double)

Scrolls the content that is within the ScrollViewer to the specified vertical offset position.

Declaration
public void ScrollToVerticalOffset(double offset)
Parameters
Type Name Description
System.Double offset

The position that the content scrolls to.

| Improve this Doc View Source

SetHorizontalScrollBarVisibility(DependencyObject, ScrollBarVisibility)

Sets the value of the HorizontalScrollBarVisibility dependency property to a specified element.

Declaration
public static void SetHorizontalScrollBarVisibility(DependencyObject element, ScrollBarVisibility horizontalScrollBarVisibility)
Parameters
Type Name Description
DependencyObject element

The element on which to set the property value.

ScrollBarVisibility horizontalScrollBarVisibility

The property value to set.

Exceptions
Type Condition
System.ArgumentNullException

element is null.

| Improve this Doc View Source

SetVerticalScrollBarVisibility(DependencyObject, ScrollBarVisibility)

Sets the value of the VerticalScrollBarVisibility dependency property to a specified element.

Declaration
public static void SetVerticalScrollBarVisibility(DependencyObject element, ScrollBarVisibility verticalScrollBarVisibility)
Parameters
Type Name Description
DependencyObject element

The element on which to set the property value.

ScrollBarVisibility verticalScrollBarVisibility

The property value to set.

Exceptions
Type Condition
System.ArgumentNullException

element is null.

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
UIElementExtendedRoutedEventExtensions.AddHandler(UIElement, ExtendedRoutedEvent, Delegate, Boolean)
UIElementExtendedRoutedEventExtensions.RemoveHandler(UIElement, ExtendedRoutedEvent, Delegate)
ScrollViewerExtensions.GetIsMouseWheelScrollingEnabled(ScrollViewer)
ScrollViewerExtensions.SetIsMouseWheelScrollingEnabled(ScrollViewer, Boolean)
ScrollViewerExtensions.LineUp(ScrollViewer)
ScrollViewerExtensions.LineDown(ScrollViewer)
ScrollViewerExtensions.LineLeft(ScrollViewer)
ScrollViewerExtensions.LineRight(ScrollViewer)
ScrollViewerExtensions.PageUp(ScrollViewer)
ScrollViewerExtensions.PageDown(ScrollViewer)
ScrollViewerExtensions.PageLeft(ScrollViewer)
ScrollViewerExtensions.PageRight(ScrollViewer)
ScrollViewerExtensions.ScrollToTop(ScrollViewer)
ScrollViewerExtensions.ScrollToBottom(ScrollViewer)
ScrollViewerExtensions.ScrollToLeft(ScrollViewer)
ScrollViewerExtensions.ScrollToRight(ScrollViewer)
ScrollViewerExtensions.ScrollIntoView(ScrollViewer, FrameworkElement)
ScrollViewerExtensions.ScrollIntoView(ScrollViewer, FrameworkElement, Double, Double, Duration)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
VisualTreeExtensions.GetBoundsRelativeTo(FrameworkElement, UIElement)
VisualTreeExtensions.InvokeOnLayoutUpdated(FrameworkElement, Action)
  • Improve this Doc
  • View Source