VirtualizingStackPanel VirtualizingStackPanel VirtualizingStackPanel Class

Arranges and virtualizes content on a single line that is oriented either horizontally or vertically. Can only be used to display items in an ItemsControl.

Syntax

Declaration

public sealed class VirtualizingStackPanelpublic sealed class VirtualizingStackPanelPublic NotInheritable Class VirtualizingStackPanel
<VirtualizingStackPanel .../>
-or-
<VirtualizingStackPanel ...>
  oneOrMoreChildren
</VirtualizingStackPanel>

Inheritance Hierarchy

Inherited Members

Inherited properties

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Tag
Tag
Tag
, , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Inherited events

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Inherited methods

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Windows.UI.Xaml.Controls.Primitives.OrientedVirtualizingPanel.GetInsertionIndexes(Windows.Foundation.Point,System.Int32,System.Int32)
Windows.UI.Xaml.Controls.Primitives.OrientedVirtualizingPanel.GetInsertionIndexes(Windows.Foundation.Point,System.Int32,System.Int32)
Windows.UI.Xaml.Controls.Primitives.OrientedVirtualizingPanel.GetInsertionIndexes(Windows.Foundation.Point,System.Int32,System.Int32)
,
Windows.UI.Xaml.Controls.Primitives.OrientedVirtualizingPanel.GetRegularSnapPoints(Windows.UI.Xaml.Controls.Orientation,Windows.UI.Xaml.Controls.Primitives.SnapPointsAlignment,System.Single)
Windows.UI.Xaml.Controls.Primitives.OrientedVirtualizingPanel.GetRegularSnapPoints(Windows.UI.Xaml.Controls.Orientation,Windows.UI.Xaml.Controls.Primitives.SnapPointsAlignment,System.Single)
Windows.UI.Xaml.Controls.Primitives.OrientedVirtualizingPanel.GetRegularSnapPoints(Windows.UI.Xaml.Controls.Orientation,Windows.UI.Xaml.Controls.Primitives.SnapPointsAlignment,System.Single)

Remarks

VirtualizingStackPanel can only be used to display items in an ItemsControl. A primary scenario for VirtualizingStackPanel is that it provides the items panel template behavior for FlipView and ListBox in default templates.

Note

Starting in Windows 8.1, ItemsStackPanel is used as the default ItemsPanel for ListView. If you modify the ItemsPanel, we recommend you use ItemsStackPanel or ItemsWrapGrid instead of VirtualizingStackPanel or WrapGrid.

VirtualizingStackPanel attached properties

VirtualizingStackPanel is the host service class for several attached properties that control or report the virtualization mode:

VirtualizationModeProperty is an Extensible Application Markup Language (XAML) attached property, and child elements set this property in markup to declare how the item should be virtualized when included as a VirtualizingStackPanel child element.

VirtualizingStackPanel.IsVirtualizing uses the attached property model as a property store, but does not support a Extensible Application Markup Language (XAML) usage. Instead, the property serves as a sentinel that any VirtualizingStackPanel child element can check to determine whether that child is currently being represented as virtualized. To find out if an item is being virtualized, call GetIsVirtualizing(DependencyObject), passing the item as the input parameter.

Constructors summary

Initializes a new instance of the VirtualizingStackPanel class.

Properties summary

Gets or sets a value that indicates whether the generated snap points used for panning in the VirtualizingStackPanel are equidistant from each other.

Identifies the AreScrollSnapPointsRegular dependency property.

Identifies the VirtualizingStackPanel.IsVirtualizing attached property.

Gets or sets a value that describes the horizontal or vertical orientation of stacked content.

Identifies the Orientation dependency property.

Identifies the VirtualizationModeProperty XAML attached property.

Methods summary

Gets a value that determines whether an item is currently being virtualized as part of an items set where the ItemsPanel is templated with a VirtualizingStackPanel.

Gets the VirtualizationModeProperty XAML attached property value for the specified target element.

Called when an item that is hosted by the VirtualizingStackPanel is re-virtualized.

Sets the VirtualizationModeProperty XAML attached property on the specified target element.

Events summary

Occurs when an item that is hosted by the VirtualizingStackPanel is re-virtualized.

Constructors

  • VirtualizingStackPanel()
    VirtualizingStackPanel()
    VirtualizingStackPanel()
    VirtualizingStackPanel()

    Initializes a new instance of the VirtualizingStackPanel class.

    public VirtualizingStackPanel()public New()Public Sub New()public VirtualizingStackPanel()

Properties

  • AreScrollSnapPointsRegular
    AreScrollSnapPointsRegular
    AreScrollSnapPointsRegular
    AreScrollSnapPointsRegular

    Gets or sets a value that indicates whether the generated snap points used for panning in the VirtualizingStackPanel are equidistant from each other.

    public bool AreScrollSnapPointsRegular { get; set; }public bool AreScrollSnapPointsRegular { get; set; }Public ReadWrite Property AreScrollSnapPointsRegular As boolpublic bool AreScrollSnapPointsRegular { get; set; }
    <VirtualizingStackPanel AreScrollSnapPointsRegular="bool" .../>
    

    Property Value

    • bool
      bool
      bool

      true if the snap points in the VirtualizingStackPanel are equidistant from each other; otherwise, false.

  • AreScrollSnapPointsRegularProperty
    AreScrollSnapPointsRegularProperty
    AreScrollSnapPointsRegularProperty
    AreScrollSnapPointsRegularProperty

    Identifies the AreScrollSnapPointsRegular dependency property.

    public static DependencyProperty AreScrollSnapPointsRegularProperty { get; }public static DependencyProperty AreScrollSnapPointsRegularProperty { get; }Public Static ReadOnly Property AreScrollSnapPointsRegularProperty As DependencyPropertypublic static DependencyProperty AreScrollSnapPointsRegularProperty { get; }

    Property Value

  • IsVirtualizingProperty
    IsVirtualizingProperty
    IsVirtualizingProperty
    IsVirtualizingProperty

    Identifies the VirtualizingStackPanel.IsVirtualizing attached property.

    public static DependencyProperty IsVirtualizingProperty { get; }public static DependencyProperty IsVirtualizingProperty { get; }Public Static ReadOnly Property IsVirtualizingProperty As DependencyPropertypublic static DependencyProperty IsVirtualizingProperty { get; }

    Property Value

    Remarks

    VirtualizingStackPanel.IsVirtualizing is an atypical attached property because it does not have a Set accessor, and thus is not really a XAML attached property with a markup usage. Instead, VirtualizingStackPanel.IsVirtualizing functions as a sentinel whereby child elements can query the VirtualizingStackPanel parent, and determine whether virtualization is being used. This might be important information for layout logic or further virtualization logic that is used by the child element itself.

  • Orientation
    Orientation
    Orientation
    Orientation

    Gets or sets a value that describes the horizontal or vertical orientation of stacked content.

    public Orientation Orientation { get; set; }public Orientation Orientation { get; set; }Public ReadWrite Property Orientation As Orientationpublic Orientation Orientation { get; set; }
    <VirtualizingStackPanel Orientation="Horizontal"/>
    - or -
    <VirtualizingStackPanel Orientation="Vertical"/>
    

    Property Value

  • OrientationProperty
    OrientationProperty
    OrientationProperty
    OrientationProperty

    Identifies the Orientation dependency property.

    public static DependencyProperty OrientationProperty { get; }public static DependencyProperty OrientationProperty { get; }Public Static ReadOnly Property OrientationProperty As DependencyPropertypublic static DependencyProperty OrientationProperty { get; }

    Property Value

  • VirtualizationModeProperty
    VirtualizationModeProperty
    VirtualizationModeProperty
    VirtualizationModeProperty

    Identifies the VirtualizationModeProperty XAML attached property.

    public static DependencyProperty VirtualizationModeProperty { get; }public static DependencyProperty VirtualizationModeProperty { get; }Public Static ReadOnly Property VirtualizationModeProperty As DependencyPropertypublic static DependencyProperty VirtualizationModeProperty { get; }

    Property Value

Methods

  • GetIsVirtualizing(DependencyObject)
    GetIsVirtualizing(DependencyObject)
    GetIsVirtualizing(DependencyObject)
    GetIsVirtualizing(DependencyObject)

    Gets a value that determines whether an item is currently being virtualized as part of an items set where the ItemsPanel is templated with a VirtualizingStackPanel.

    public static bool GetIsVirtualizing(DependencyObject o)public static bool GetIsVirtualizing(DependencyObject o)Public Static Function GetIsVirtualizing(o As DependencyObject) As boolpublic static bool GetIsVirtualizing(DependencyObject o)

    Parameters

    Returns

    • bool
      bool
      bool

      true if the item specified by o is currently virtualizing its content; otherwise, false.

    Remarks

    VirtualizingStackPanel.IsVirtualizing uses the attached property model as a property store, but does not support a XAML usage. Instead, the property serves as a sentinel that any VirtualizingStackPanel child element can check to determine whether that child is currently being represented as virtualized. To find out if an item is being virtualized, call GetIsVirtualizing(DependencyObject), passing the item as the input parameter.

  • GetVirtualizationMode(DependencyObject)
    GetVirtualizationMode(DependencyObject)
    GetVirtualizationMode(DependencyObject)
    GetVirtualizationMode(DependencyObject)

    Gets the VirtualizationModeProperty XAML attached property value for the specified target element.

    public static VirtualizationMode GetVirtualizationMode(DependencyObject element)public static VirtualizationMode GetVirtualizationMode(DependencyObject element)Public Static Function GetVirtualizationMode(element As DependencyObject) As VirtualizationModepublic static VirtualizationMode GetVirtualizationMode(DependencyObject element)

    Parameters

    Returns

    Remarks

    For more info, see the VirtualizationModeProperty attached property.

  • OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs)
    OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs)
    OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs)
    OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs)

    Called when an item that is hosted by the VirtualizingStackPanel is re-virtualized.

    protected virtual void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)protected virtual void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)Protected Overridable Function OnCleanUpVirtualizedItem(e As CleanUpVirtualizedItemEventArgs) As voidprotected virtual void OnCleanUpVirtualizedItem(CleanUpVirtualizedItemEventArgs e)

    Parameters

  • SetVirtualizationMode(DependencyObject, VirtualizationMode)
    SetVirtualizationMode(DependencyObject, VirtualizationMode)
    SetVirtualizationMode(DependencyObject, VirtualizationMode)
    SetVirtualizationMode(DependencyObject, VirtualizationMode)

    Sets the VirtualizationModeProperty XAML attached property on the specified target element.

    public static void SetVirtualizationMode(DependencyObject element, VirtualizationMode value)public static void SetVirtualizationMode(DependencyObject element, VirtualizationMode value)Public Static Function SetVirtualizationMode(element As DependencyObject, value As VirtualizationMode) As voidpublic static void SetVirtualizationMode(DependencyObject element, VirtualizationMode value)

    Parameters

    Remarks

    For more info, see the VirtualizationModeProperty attached property.

Events

  • CleanUpVirtualizedItemEvent
    CleanUpVirtualizedItemEvent
    CleanUpVirtualizedItemEvent
    CleanUpVirtualizedItemEvent

    Occurs when an item that is hosted by the VirtualizingStackPanel is re-virtualized.

    public event CleanUpVirtualizedItemEventHandler CleanUpVirtualizedItemEventpublic event CleanUpVirtualizedItemEventHandler CleanUpVirtualizedItemEventPublic Event CleanUpVirtualizedItemEventpublic event CleanUpVirtualizedItemEventHandler CleanUpVirtualizedItemEvent
    <VirtualizingStackPanel CleanUpVirtualizedItemEvent="eventhandler" />
    

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Controls.dll