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
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin