Skip to main content

IndexPath Struct

Definition

Assembly:Avalonia.Controls.TreeDataGrid
Package:Avalonia.Controls.TreeDataGrid

Represents a path of indexes used to identify a specific item in a hierarchical data structure. Each index in the path represents a level of depth in the hierarchy.

public struct IndexPath

Inheritance: ValueType -> IndexPath

Implements: IEnumerable<int>, IReadOnlyCollection<int>, IReadOnlyList<int>, IEnumerable, IComparable<IndexPath>, IEquatable<IndexPath>

Remarks

IndexPath is used to specify the location of an item in a hierarchical data structure. Each index in the path represents a level of depth in the hierarchy.

Consider the following tree structure:

Item A IndexPath: (0)
├─ Item A1 IndexPath: (0, 0)
└─ Item A2 IndexPath: (0, 1)
Item B IndexPath: (1)
├─ Item B1 IndexPath: (1, 0)
│ └─ Item B1a IndexPath: (1, 0, 0)
└─ Item B2 IndexPath: (1, 1)
Item C IndexPath: (2)
└─ Item C1 IndexPath: (2, 0)

Each IndexPath represents the sequence of child indexes needed to navigate from the root to reach that specific item in the hierarchy.

Constructors

NameDescription
IndexPath (3 overloads)No summary available.

IndexPath overloads

IndexPath Constructor

public IndexPath(System.Collections.Generic.IEnumerable<int> indexes)
Parameters

indexes System.Collections.Generic.IEnumerable<int>

IndexPath Constructor

Initializes a new instance of the Avalonia.Controls.IndexPath struct with a single index.

public IndexPath(int index)
Parameters

index int

The index value.

IndexPath Constructor

Initializes a new instance of the Avalonia.Controls.IndexPath struct with multiple indexes.

public IndexPath(int[] indexes)
Parameters

indexes int[]

The array of indexes representing the path.

Methods

NameDescription
AppendCreates a new IndexPath by appending a child index to this path.
CompareToCompares this IndexPath with another IndexPath.
Equals (2 overloads)Determines whether the specified IndexPath is equal to this IndexPath.
GetEnumeratorReturns an enumerator that iterates through the indexes in this path.
GetHashCodeReturns the hash code for this IndexPath.
IsAncestorOfNo summary available.
IsParentOfNo summary available.
SliceCreates a new IndexPath containing a portion of this path.
ToArrayConverts this IndexPath to an array of integers.
ToStringReturns a string representation of the IndexPath.

Append Method

Creates a new IndexPath by appending a child index to this path.

public Avalonia.Controls.IndexPath Append(int childIndex)

Parameters

childIndex int

The child index to append.

Returns

Avalonia.Controls.IndexPath

A new IndexPath with the child index appended.

Exceptions

CompareTo Method

Compares this IndexPath with another IndexPath.

public int CompareTo(Avalonia.Controls.IndexPath other)

Parameters

other Avalonia.Controls.IndexPath

The IndexPath to compare with.

Returns

int

A value less than 0 if this path is less than other, 0 if equal, greater than 0 if greater.

Equals overloads

Equals Method

Determines whether the specified IndexPath is equal to this IndexPath.

public bool Equals(Avalonia.Controls.IndexPath other)
Parameters

other Avalonia.Controls.IndexPath

The IndexPath to compare with this IndexPath.

Returns

bool

true if the specified IndexPath is equal to this IndexPath; otherwise, false.

Equals Method

Determines whether the specified object is equal to this IndexPath.

public bool Equals(object obj)
Parameters

obj object

The object to compare with this IndexPath.

Returns

bool

true if the specified object is equal to this IndexPath; otherwise, false.

GetEnumerator Method

Returns an enumerator that iterates through the indexes in this path.

public System.Collections.Generic.IEnumerator<int> GetEnumerator()

Returns

System.Collections.Generic.IEnumerator<int>

An enumerator for the indexes in this path.

GetHashCode Method

Returns the hash code for this IndexPath.

public int GetHashCode()

Returns

int

A hash code for this IndexPath.

IsAncestorOf Method

public bool IsAncestorOf(Avalonia.Controls.IndexPath& other)

Parameters

other Avalonia.Controls.IndexPath&

Returns

bool

IsParentOf Method

public bool IsParentOf(Avalonia.Controls.IndexPath& other)

Parameters

other Avalonia.Controls.IndexPath&

Returns

bool

Slice Method

Creates a new IndexPath containing a portion of this path.

public Avalonia.Controls.IndexPath Slice(int start, int length)

Parameters

start int

The starting position of the slice.

length int

The number of indexes to include in the slice.

Returns

Avalonia.Controls.IndexPath

A new IndexPath containing the specified portion of this path.

Exceptions

ToArray Method

Converts this IndexPath to an array of integers.

public int[] ToArray()

Returns

int[]

An array containing all indexes in this path.

ToString Method

Returns a string representation of the IndexPath.

public string ToString()

Returns

string

A string in the format "(index1.index2.index3)" or "()" for empty paths.

Properties

NameDescription
CountGets the number of indexes in this path.
ItemNo summary available.

Count Property

Gets the number of indexes in this path.

public int Count { get; set; }

Item Property

public int Item { get; set; }

Fields

NameDescription
UnselectedGets an empty IndexPath representing no selection.

Unselected Field

Gets an empty IndexPath representing no selection.

public Avalonia.Controls.IndexPath Unselected