Table of Contents

Class ScrollContentPresenter

Namespace
Avalonia.Controls.Presenters
Assembly
Avalonia.Controls.dll

Presents a scrolling view of content inside a ScrollViewer.

public class ScrollContentPresenter : ContentPresenter, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, IScrollable, IScrollAnchorProvider
Inheritance
ScrollContentPresenter
Implements
Inherited Members
Extension Methods

Constructors

ScrollContentPresenter()

Initializes a new instance of the ScrollContentPresenter class.

public ScrollContentPresenter()

Fields

CanHorizontallyScrollProperty

Defines the CanHorizontallyScroll property.

public static readonly StyledProperty<bool> CanHorizontallyScrollProperty

Field Value

StyledProperty<bool>

CanVerticallyScrollProperty

Defines the CanVerticallyScroll property.

public static readonly StyledProperty<bool> CanVerticallyScrollProperty

Field Value

StyledProperty<bool>

ExtentProperty

Defines the Extent property.

public static readonly DirectProperty<ScrollContentPresenter, Size> ExtentProperty

Field Value

DirectProperty<ScrollContentPresenter, Size>

HorizontalSnapPointsAlignmentProperty

Defines the HorizontalSnapPointsAlignment property.

public static readonly StyledProperty<SnapPointsAlignment> HorizontalSnapPointsAlignmentProperty

Field Value

StyledProperty<SnapPointsAlignment>

HorizontalSnapPointsTypeProperty

Defines the HorizontalSnapPointsType property.

public static readonly StyledProperty<SnapPointsType> HorizontalSnapPointsTypeProperty

Field Value

StyledProperty<SnapPointsType>

IsScrollChainingEnabledProperty

Defines the IsScrollChainingEnabled property.

public static readonly StyledProperty<bool> IsScrollChainingEnabledProperty

Field Value

StyledProperty<bool>

OffsetProperty

Defines the Offset property.

public static readonly StyledProperty<Vector> OffsetProperty

Field Value

StyledProperty<Vector>

VerticalSnapPointsAlignmentProperty

Defines the VerticalSnapPointsAlignment property.

public static readonly StyledProperty<SnapPointsAlignment> VerticalSnapPointsAlignmentProperty

Field Value

StyledProperty<SnapPointsAlignment>

VerticalSnapPointsTypeProperty

Defines the VerticalSnapPointsType property.

public static readonly StyledProperty<SnapPointsType> VerticalSnapPointsTypeProperty

Field Value

StyledProperty<SnapPointsType>

ViewportProperty

Defines the Viewport property.

public static readonly DirectProperty<ScrollContentPresenter, Size> ViewportProperty

Field Value

DirectProperty<ScrollContentPresenter, Size>

Properties

CanHorizontallyScroll

Gets or sets a value indicating whether the content can be scrolled horizontally.

public bool CanHorizontallyScroll { get; set; }

Property Value

bool

CanVerticallyScroll

Gets or sets a value indicating whether the content can be scrolled horizontally.

public bool CanVerticallyScroll { get; set; }

Property Value

bool

Extent

Gets the extent of the scrollable content.

public Size Extent { get; }

Property Value

Size

HorizontalSnapPointsAlignment

Gets or sets how the existing snap points are horizontally aligned versus the initial viewport.

public SnapPointsAlignment HorizontalSnapPointsAlignment { get; set; }

Property Value

SnapPointsAlignment

HorizontalSnapPointsType

Gets or sets how scroll gesture reacts to the snap points along the horizontal axis.

public SnapPointsType HorizontalSnapPointsType { get; set; }

Property Value

SnapPointsType

IsScrollChainingEnabled

Gets or sets if scroll chaining is enabled. The default value is true.

public bool IsScrollChainingEnabled { get; set; }

Property Value

bool

Remarks

After a user hits a scroll limit on an element that has been nested within another scrollable element, you can specify whether that parent element should continue the scrolling operation begun in its child element. This is called scroll chaining.

Offset

Gets or sets the current scroll offset.

public Vector Offset { get; set; }

Property Value

Vector

VerticalSnapPointsAlignment

Gets or sets how the existing snap points are vertically aligned versus the initial viewport.

public SnapPointsAlignment VerticalSnapPointsAlignment { get; set; }

Property Value

SnapPointsAlignment

VerticalSnapPointsType

Gets or sets how scroll gesture reacts to the snap points along the vertical axis.

public SnapPointsType VerticalSnapPointsType { get; set; }

Property Value

SnapPointsType

Viewport

Gets the size of the viewport on the scrollable content.

public Size Viewport { get; }

Property Value

Size

Methods

ArrangeOverride(Size)

Positions child elements as part of a layout pass.

protected override Size ArrangeOverride(Size finalSize)

Parameters

finalSize Size

The size available to the control.

Returns

Size

The actual size used.

BringDescendantIntoView(Visual, Rect)

Attempts to bring a portion of the target visual into view by scrolling the content.

public bool BringDescendantIntoView(Visual target, Rect targetRect)

Parameters

target Visual

The target visual.

targetRect Rect

The portion of the target visual to bring into view.

Returns

bool

True if the scroll offset was changed; otherwise false.

MeasureOverride(Size)

Measures the control and its child elements as part of a layout pass.

protected override Size MeasureOverride(Size availableSize)

Parameters

availableSize Size

The size available to the control.

Returns

Size

The desired size for the control.

OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)

Called when the control is added to a rooted visual tree.

protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)

Parameters

e VisualTreeAttachmentEventArgs

The event args.

OnPointerWheelChanged(PointerWheelEventArgs)

Called before the PointerWheelChanged event occurs.

protected override void OnPointerWheelChanged(PointerWheelEventArgs e)

Parameters

e PointerWheelEventArgs

The event args.

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)

Parameters

change AvaloniaPropertyChangedEventArgs

The property change details.