Redigera

Dela via


ItemContainerGenerator.IndexFromContainer Method

Definition

Returns the index to an item that corresponds to the specified, generated UIElement.

Overloads

IndexFromContainer(DependencyObject)

Returns the index to an item that corresponds to the specified, generated UIElement.

IndexFromContainer(DependencyObject, Boolean)

Returns the index to an item that corresponds to the specified, generated UIElement, optionally recursively searching hierarchical items.

IndexFromContainer(DependencyObject)

Returns the index to an item that corresponds to the specified, generated UIElement.

public:
 int IndexFromContainer(System::Windows::DependencyObject ^ container);
public int IndexFromContainer (System.Windows.DependencyObject container);
member this.IndexFromContainer : System.Windows.DependencyObject -> int
Public Function IndexFromContainer (container As DependencyObject) As Integer

Parameters

container
DependencyObject

The DependencyObject that corresponds to the item to the index to be returned.

Returns

An Int32 index to an item that corresponds to the specified, generated UIElement or -1 if container is not found.

Exceptions

container is null.

Remarks

Calling this method is identical to calling the ItemContainerGenerator.IndexFromContainer(DependencyObject, Boolean) method and passing false to the returnLocalIndex parameter.

Applies to

IndexFromContainer(DependencyObject, Boolean)

Returns the index to an item that corresponds to the specified, generated UIElement, optionally recursively searching hierarchical items.

public:
 int IndexFromContainer(System::Windows::DependencyObject ^ container, bool returnLocalIndex);
public int IndexFromContainer (System.Windows.DependencyObject container, bool returnLocalIndex);
member this.IndexFromContainer : System.Windows.DependencyObject * bool -> int
Public Function IndexFromContainer (container As DependencyObject, returnLocalIndex As Boolean) As Integer

Parameters

container
DependencyObject

The DependencyObject that corresponds to the item to the index to be returned.

returnLocalIndex
Boolean

true to search the current level of hierarchical items; false to recursively search hierarchical items.

Returns

An Int32 index to an item that corresponds to the specified, generated UIElement or -1 if container is not found.

Applies to