GeneratorPosition 結構
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
GeneratorPosition 可用來描述由 ItemContainerGenerator 管理之項目的位置。
public value class GeneratorPosition
public struct GeneratorPosition
type GeneratorPosition = struct
Public Structure 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 物件的值是否不相等。 |