UIElementCollection.First method

Applies to Windows and Windows Phone

Returns the iterator object that can iterate over the items in the UIElementCollection.

Syntax


public:
IIterator<UIElement>^ First()

Parameters

This method has no parameters.

Return value

Type: IIterator<UIElement>

The iterator object. The iterator's current position is at the 0-index position, or at the collection end if the collection is empty.

Remarks

A convenient way to hold the iterator returned by First is to assign the return value to a variable that is declared with the auto type deduction keyword. Then use IIterator API as part of a while loop. For example:


auto iterator1 = uieCollection->First();
while (iterator1->HasCurrent)
{
    auto currentItem = iterator1->Current;
    //your logic here that does something with currentItem
    iterator1->MoveNext();
}

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows::UI::Xaml::Controls

Metadata

Windows.winmd

See also

UIElementCollection
IIterator

 

 

Show:
© 2014 Microsoft