UIElementCollection.First Method
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.
Returns the iterator object that can iterate over the items in the UIElementCollection.
public:
virtual IIterator<UIElement ^> ^ First() = IIterable<UIElement ^>::First;
IIterator<UIElement> First();
public IIterator<UIElement> First();
function first()
Public Function First () As IIterator(Of UIElement)
Returns
The iterator object. The iterator's current position is at the 0-index position, or at the collection end if the collection is empty.
Implements
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())
{
Windows::UI::Xaml::UIElement currentItem{ iterator1.Current() };
// Your logic here that does something with currentItem.
iterator1.MoveNext();
}
auto iterator1 = uieCollection->First();
while (iterator1->HasCurrent)
{
auto currentItem = iterator1->Current;
//your logic here that does something with currentItem
iterator1->MoveNext();
}
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for