GeneratorPosition 结构

定义

GeneratorPosition 用于描述由 ItemContainerGenerator 管理的项的位置。

public value class GeneratorPosition
public struct GeneratorPosition
type GeneratorPosition = struct
Public Structure GeneratorPosition
继承
GeneratorPosition

示例

以下示例演示如何用于 GeneratorPosition 从项列表的开头开始生成。

// Start generating items forward from the beginning of the item list
GeneratorPosition position = new GeneratorPosition(-1, 0);
GeneratorDirection direction = GeneratorDirection.Forward;
IItemContainerGenerator generator = (IItemContainerGenerator)this.itemsControl.ItemContainerGenerator;
generator.StartAt(position, direction);
' Start generating items forward from the beginning of the item list
Dim position As New GeneratorPosition(-1, 0)
Dim direction As GeneratorDirection = GeneratorDirection.Forward
Dim generator As IItemContainerGenerator = CType(Me.itemsControl.ItemContainerGenerator, IItemContainerGenerator)
generator.StartAt(position, direction)

下面的示例演示如何用于 GeneratorPosition 从项列表末尾向后生成。

// Start generating items backward from the end of the item list
GeneratorPosition position = new GeneratorPosition(-1, 0);
GeneratorDirection direction = GeneratorDirection.Backward;
IItemContainerGenerator generator = (IItemContainerGenerator)this.itemsControl.ItemContainerGenerator;
generator.StartAt(position, direction);
' Start generating items backward from the end of the item list
Dim position As New GeneratorPosition(-1, 0)
Dim direction As GeneratorDirection = GeneratorDirection.Backward
Dim generator As IItemContainerGenerator = CType(Me.itemsControl.ItemContainerGenerator, IItemContainerGenerator)
generator.StartAt(position, direction)

以下示例演示了如何使用 GeneratorPosition 它从项列表中间开始向前生成。

// Start generating items forward,
// starting with the first unrealized item (offset of 1),
// after the 5th realized item
// (the item with index 4 among all realized items) in the list
GeneratorPosition position = new GeneratorPosition(4, 1);
GeneratorDirection direction = GeneratorDirection.Forward;
IItemContainerGenerator generator = (IItemContainerGenerator)this.itemsControl.ItemContainerGenerator;
generator.StartAt(position, direction);
' Start generating items forward,
' starting with the first unrealized item (offset of 1),
' after the 5th realized item
' (the item with index 4 among all realized items) in the list
Dim position As New GeneratorPosition(4, 1)
Dim direction As GeneratorDirection = GeneratorDirection.Forward
Dim generator As IItemContainerGenerator = CType(Me.itemsControl.ItemContainerGenerator, IItemContainerGenerator)
generator.StartAt(position, direction)

注解

GeneratorPosition 使用 StartAt

构造函数

GeneratorPosition(Int32, Int32)

使用指定的索引和偏移量初始化 GeneratorPosition 的新实例。

属性

Index

获取或设置与已生成(已实现)项相关的 Int32 索引。

Offset

获取或设置与已索引项旁未生成(未实现)项相关的 Int32 偏移量。

方法

Equals(Object)

将指定实例与当前的 GeneratorPosition 实例比较值是否相等。

GetHashCode()

返回此 GeneratorPosition 的哈希代码。

ToString()

返回此 GeneratorPosition 实例的字符串表示形式。

运算符

Equality(GeneratorPosition, GeneratorPosition)

比较两个 GeneratorPosition 对象的值是否相等。

Inequality(GeneratorPosition, GeneratorPosition)

比较两个 GeneratorPosition 对象的值是否相等。

适用于