Table of Contents

Class VirtualizingPanelBase

Namespace
Wpf.Ui.Controls
Assembly
Wpf.Ui.dll

Base abstract class for creating virtualized panels.

Based on https://github.com/sbaeumlisberger/VirtualizingWrapPanel.

public abstract class VirtualizingPanelBase : VirtualizingPanel, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, IScrollInfo
Inheritance
VirtualizingPanelBase
Implements
Derived
Inherited Members

Fields

MouseWheelDeltaItemProperty

Identifies the MouseWheelDeltaItem dependency property.

public static readonly DependencyProperty MouseWheelDeltaItemProperty

Field Value

DependencyProperty

MouseWheelDeltaProperty

Identifies the MouseWheelDelta dependency property.

public static readonly DependencyProperty MouseWheelDeltaProperty

Field Value

DependencyProperty

ScrollLineDeltaItemProperty

Identifies the ScrollLineDeltaItem dependency property.

public static readonly DependencyProperty ScrollLineDeltaItemProperty

Field Value

DependencyProperty

ScrollLineDeltaProperty

Identifies the ScrollLineDelta dependency property.

public static readonly DependencyProperty ScrollLineDeltaProperty

Field Value

DependencyProperty

Properties

CacheLength

Gets the cache length before and after the viewport.

protected VirtualizationCacheLength CacheLength { get; }

Property Value

VirtualizationCacheLength

CacheLengthUnit

Gets the Unit of the cache length. Can be Pixel, Item or Page. When the ItemsOwner is a group item it can only be pixel or item.

protected VirtualizationCacheLengthUnit CacheLengthUnit { get; }

Property Value

VirtualizationCacheLengthUnit

CanHierarchicallyScrollAndVirtualizeCore

Gets a value that indicates whether the VirtualizingPanel can virtualize items that are grouped or organized in a hierarchy.

protected override bool CanHierarchicallyScrollAndVirtualizeCore { get; }

Property Value

bool

false in all cases.

CanHorizontallyScroll

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

public bool CanHorizontallyScroll { get; set; }

Property Value

bool

CanVerticallyScroll

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

public bool CanVerticallyScroll { get; set; }

Property Value

bool

Extent

Gets the Extent.

protected Size Extent { get; }

Property Value

Size

ExtentHeight

Gets height of the Extent.

public double ExtentHeight { get; }

Property Value

double

ExtentWidth

Gets width of the Extent.

public double ExtentWidth { get; }

Property Value

double

HorizontalOffset

Gets the horizontal offset.

public double HorizontalOffset { get; }

Property Value

double

IsRecycling

Gets a value indicating whether the panel is in VirtualizationMode.Recycling.

protected bool IsRecycling { get; }

Property Value

bool

IsVirtualizing

Gets a value indicating whether the virtualizing is enabled.

protected bool IsVirtualizing { get; }

Property Value

bool

ItemContainerGenerator

Gets items container.

protected IRecyclingItemContainerGenerator ItemContainerGenerator { get; }

Property Value

IRecyclingItemContainerGenerator

ItemRange

Gets or sets the range of items that a realized in Viewport or cache.

protected ItemRange ItemRange { get; set; }

Property Value

ItemRange

Items

Gets items collection.

protected ReadOnlyCollection<object> Items { get; }

Property Value

ReadOnlyCollection<object>

ItemsControl

Gets the ItemsControl (e.g. ListView).

protected ItemsControl ItemsControl { get; }

Property Value

ItemsControl

ItemsOwner

Gets the ItemsControl (e.g. ListView) or if the ItemsControl is grouping a GroupItem.

protected DependencyObject ItemsOwner { get; }

Property Value

DependencyObject

MouseWheelDelta

Gets or sets the mouse wheel delta for pixel based scrolling. The default value is 48 dp.

public double MouseWheelDelta { get; set; }

Property Value

double

MouseWheelDeltaItem

Gets or sets the mouse wheel delta for item based scrolling. The default value is 3 items.

public int MouseWheelDeltaItem { get; set; }

Property Value

int

MouseWheelScrollDirection

Gets or sets the direction in which the panel scrolls when user turns the mouse wheel.

protected ScrollDirection MouseWheelScrollDirection { get; set; }

Property Value

ScrollDirection

Offset

Gets the offset.

protected Point Offset { get; }

Property Value

Point

ScrollLineDelta

Gets or sets the scroll line delta for pixel based scrolling. The default value is 16 dp.

public double ScrollLineDelta { get; set; }

Property Value

double

ScrollLineDeltaItem

Gets or sets the scroll line delta for item based scrolling. The default value is 1 item.

public int ScrollLineDeltaItem { get; set; }

Property Value

int

ScrollOwner

Gets or sets the scroll owner.

public ScrollViewer? ScrollOwner { get; set; }

Property Value

ScrollViewer

ScrollUnit

Gets the scroll unit.

protected ScrollUnit ScrollUnit { get; }

Property Value

ScrollUnit

VerticalOffset

Gets the vertical offset.

public double VerticalOffset { get; }

Property Value

double

Viewport

Gets the viewport.

protected Size Viewport { get; }

Property Value

Size

ViewportHeight

Gets the Viewport height.

public double ViewportHeight { get; }

Property Value

double

ViewportWidth

Gets the Viewport width.

public double ViewportWidth { get; }

Property Value

double

VirtualizationMode

Gets the virtualization mode.

protected VirtualizationMode VirtualizationMode { get; }

Property Value

VirtualizationMode

Methods

CalculateExtent(Size)

Calculates the extent that would be needed to show all items.

protected abstract Size CalculateExtent(Size availableSize)

Parameters

availableSize Size

Returns

Size

GetGeneratorPositionFromChildIndex(int)

Gets the position of children from the generator.

protected virtual GeneratorPosition GetGeneratorPositionFromChildIndex(int childIndex)

Parameters

childIndex int

Returns

GeneratorPosition

GetItemIndexFromChildIndex(int)

Gets item index from the generator.

protected int GetItemIndexFromChildIndex(int childIndex)

Parameters

childIndex int

Returns

int

GetLineDownScrollAmount()

Gets line down scroll amount.

protected abstract double GetLineDownScrollAmount()

Returns

double

GetLineLeftScrollAmount()

Gets line left scroll amount.

protected abstract double GetLineLeftScrollAmount()

Returns

double

GetLineRightScrollAmount()

Gets line right scroll amount.

protected abstract double GetLineRightScrollAmount()

Returns

double

GetLineUpScrollAmount()

Gets line up scroll amount.

protected abstract double GetLineUpScrollAmount()

Returns

double

GetMouseWheelDownScrollAmount()

Gets mouse wheel down scroll amount.

protected abstract double GetMouseWheelDownScrollAmount()

Returns

double

GetMouseWheelLeftScrollAmount()

Gets mouse wheel left scroll amount.

protected abstract double GetMouseWheelLeftScrollAmount()

Returns

double

GetMouseWheelRightScrollAmount()

Gets mouse wheel right scroll amount.

protected abstract double GetMouseWheelRightScrollAmount()

Returns

double

GetMouseWheelUpScrollAmount()

Gets mouse wheel up scroll amount.

protected abstract double GetMouseWheelUpScrollAmount()

Returns

double

GetPageDownScrollAmount()

Gets page down scroll amount.

protected abstract double GetPageDownScrollAmount()

Returns

double

GetPageLeftScrollAmount()

Gets page left scroll amount.

protected abstract double GetPageLeftScrollAmount()

Returns

double

GetPageRightScrollAmount()

Gets page right scroll amount.

protected abstract double GetPageRightScrollAmount()

Returns

double

GetPageUpScrollAmount()

Gets page up scroll amount.

protected abstract double GetPageUpScrollAmount()

Returns

double

LineDown()

Scrolls down within content by one logical unit.

public void LineDown()

LineLeft()

Scrolls left within content by one logical unit.

public void LineLeft()

LineRight()

Scrolls right within content by one logical unit.

public void LineRight()

LineUp()

Scrolls up within content by one logical unit.

public void LineUp()

MakeVisible(Visual, Rect)

Forces content to scroll until the coordinate space of a Visual object is visible.

public virtual Rect MakeVisible(Visual visual, Rect rectangle)

Parameters

visual Visual

A Visual that becomes visible.

rectangle Rect

A bounding rectangle that identifies the coordinate space to make visible.

Returns

Rect

A Rect that is visible.

MeasureOverride(Size)

When overridden in a derived class, measures the size in layout required for child elements and determines a size for the FrameworkElement-derived class.

protected override Size MeasureOverride(Size availableSize)

Parameters

availableSize Size

The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.

Returns

Size

The size that this element determines it needs during layout, based on its calculations of child element sizes.

MouseWheelDown()

Scrolls down within content after a user clicks the wheel button on a mouse.

public void MouseWheelDown()

MouseWheelLeft()

Scrolls left within content after a user clicks the wheel button on a mouse.

public void MouseWheelLeft()

MouseWheelRight()

Scrolls right within content after a user clicks the wheel button on a mouse.

public void MouseWheelRight()

MouseWheelUp()

Scrolls up within content after a user clicks the wheel button on a mouse.

public void MouseWheelUp()

OnItemsChanged(object, ItemsChangedEventArgs)

Called when the Items collection that is associated with the ItemsControl for this Panel changes.

protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args)

Parameters

sender object

The object that raised the event.

args ItemsChangedEventArgs

Provides data for the ItemsChanged event.

PageDown()

Scrolls down within content by one page.

public void PageDown()

PageLeft()

Scrolls left within content by one page.

public void PageLeft()

PageRight()

Scrolls right within content by one page.

public void PageRight()

PageUp()

Scrolls up within content by one page.

public void PageUp()

RealizeItems()

Realizes visible and cached items.

protected virtual void RealizeItems()

ScrollHorizontal(double)

Sets horizontal scroll offset by given amount.

protected void ScrollHorizontal(double amount)

Parameters

amount double

The value by which the offset is to be increased.

ScrollVertical(double)

Sets vertical scroll offset by given amount.

protected void ScrollVertical(double amount)

Parameters

amount double

The value by which the offset is to be increased.

SetHorizontalOffset(double)

Sets the horizontal offset.

public void SetHorizontalOffset(double offset)

Parameters

offset double

SetVerticalOffset(double)

Sets the vertical offset.

public void SetVerticalOffset(double offset)

Parameters

offset double

UpdateItemRange()

Calculates the item range that is visible in the viewport or cached.

protected abstract ItemRange UpdateItemRange()

Returns

ItemRange

UpdateScrollInfo(Size, Size)

Updates scroll offset, extent and viewport.

protected virtual void UpdateScrollInfo(Size availableSize, Size extent)

Parameters

availableSize Size
extent Size

VirtualizeItems()

Virtualizes (cleanups) no longer visible or cached items.

protected virtual void VirtualizeItems()