GeneratorPosition Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
GeneratorPosition is used to describe the position of an item that is managed by ItemContainerGenerator.
public value class GeneratorPosition
public struct GeneratorPosition
type GeneratorPosition = struct
Public Structure GeneratorPosition
- Inheritance
Examples
The following example illustrates how to use GeneratorPosition to start generating forward from the beginning of an item list.
// 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)
The following example illustrates how to use GeneratorPosition to start generating backward from the end of an item list.
// 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)
The following example illustrates how to use GeneratorPosition to start generating forward from the middle of an item list.
// 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)
Remarks
GeneratorPosition is used by StartAt.
Constructors
GeneratorPosition(Int32, Int32) |
Initializes a new instance of GeneratorPosition with the specified index and offset. |
Properties
Index |
Gets or sets the Int32 index that is relative to the generated (realized) items. |
Offset |
Gets or sets the Int32 offset that is relative to the ungenerated (unrealized) items near the indexed item. |
Methods
Equals(Object) |
Compares the specified instance and the current instance of GeneratorPosition for value equality. |
GetHashCode() |
Returns the hash code for this GeneratorPosition. |
ToString() |
Returns a string representation of this instance of GeneratorPosition. |
Operators
Equality(GeneratorPosition, GeneratorPosition) |
Compares two GeneratorPosition objects for value equality. |
Inequality(GeneratorPosition, GeneratorPosition) |
Compares two GeneratorPosition objects for value inequality. |
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기