GeneratorPosition Struktura

Definicja

GeneratorPosition służy do opisywania pozycji elementu zarządzanego przez ItemContainerGeneratorprogram .

public value class GeneratorPosition
public struct GeneratorPosition
type GeneratorPosition = struct
Public Structure GeneratorPosition
Dziedziczenie
GeneratorPosition

Przykłady

W poniższym przykładzie pokazano, jak za pomocą polecenia GeneratorPosition rozpocząć generowanie dalej od początku listy elementów.

// 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)

W poniższym przykładzie pokazano, jak użyć GeneratorPosition polecenia , aby rozpocząć generowanie wstecz od końca listy elementów.

// 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)

W poniższym przykładzie pokazano, jak za pomocą polecenia GeneratorPosition rozpocząć generowanie dalej na środku listy elementów.

// 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)

Uwagi

GeneratorPositionjest używany przez .StartAt

Konstruktory

GeneratorPosition(Int32, Int32)

Inicjuje nowe wystąpienie GeneratorPosition z określonym indeksem i przesunięciem.

Właściwości

Index

Pobiera lub ustawia Int32 indeks względem wygenerowanych (zrealizowanych) elementów.

Offset

Pobiera lub ustawia Int32 przesunięcie względem niegenerowanych (niezrealizowanych) elementów w pobliżu indeksowanego elementu.

Metody

Equals(Object)

Porównuje określone wystąpienie i bieżące wystąpienie GeneratorPosition elementu dla równości wartości.

GetHashCode()

Zwraca kod skrótu dla tego GeneratorPosition.

ToString()

Zwraca reprezentację ciągu tego wystąpienia klasy GeneratorPosition.

Operatory

Equality(GeneratorPosition, GeneratorPosition)

Porównuje dwa GeneratorPosition obiekty pod kątem równości wartości.

Inequality(GeneratorPosition, GeneratorPosition)

Porównuje dwa GeneratorPosition obiekty pod kątem nierówności wartości.

Dotyczy