UIElementCollection 클래스

정의

UIElement 개체의 정렬된 컬렉션을 나타냅니다.

public ref class UIElementCollection sealed : IIterable<UIElement ^>, IVector<UIElement ^>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class UIElementCollection final : IIterable<UIElement>, IVector<UIElement>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class UIElementCollection final : IIterable<UIElement>, IVector<UIElement>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class UIElementCollection : IEnumerable<UIElement>, IList<UIElement>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class UIElementCollection : IEnumerable<UIElement>, IList<UIElement>
Public NotInheritable Class UIElementCollection
Implements IEnumerable(Of UIElement), IList(Of UIElement)
<panelobject>
  oneOrMoreChildren
</panelobject>
상속
Object Platform::Object IInspectable UIElementCollection
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

설명

UIElementCollection은 PanelChildren 속성에서 가져오는 개체의 형식입니다. 예를 들어 Grid.Children에서 값을 가져오는 경우 해당 값은 UIElementCollection instance. Windows 런타임 API에서 UIElementCollection을 사용하는 모든 속성은 읽기 전용 속성으로, 개체가 처음 인스턴스화될 때 속성이 0개 항목으로 초기화됩니다. 그러나 UIElementCollection 속성 및 메서드를 사용하여 런타임에 컬렉션에서 항목을 추가, 제거 또는 쿼리할 수 있습니다.

UIElementCollection의 항목 유형은 UIElement로 제한됩니다. 그러나 UIElement는 XAML을 사용하는 Windows 런타임 기본 요소 클래스이므로 UIElement로 처리할 수 있는 수백 가지 요소 형식이 있으므로 UIElementCollection의 항목 중 하나일 수 있습니다.

C# 또는 Microsoft Visual Basic에서 컬렉션 열거

UIElementCollection은 열거 가능하므로 C#의 foreach 와 같은 언어별 구문을 사용하여 UIElementCollection의 항목을 열거할 수 있습니다. 컴파일러는 형식 캐스팅을 수행하므로 명시적으로 캐스팅 IEnumerable<UIElement> 할 필요가 없습니다. 예를 들어 GetEnumerator를 호출하려는 경우 명시적으로 캐스팅해야 하는 경우 UIElement 제약 조건을 사용하여 IEnumerable<T>로 캐스팅합니다.

속성

Size

컬렉션의 크기(개수)를 가져옵니다.

메서드

Append(UIElement)

컬렉션에 새 항목을 추가합니다.

Clear()

컬렉션에서 모든 항목을 제거합니다.

First()

UIElementCollection의 항목을 반복할 수 있는 반복기 개체를 반환합니다.

GetAt(UInt32)

지정된 인덱스 에 있는 항목을 반환합니다.

GetMany(UInt32, UIElement[])

반복기를 통해 한 번의 패스로 여러 요소를 검색합니다.

GetView()

컬렉션에 변경할 수 없는 보기를 가져옵니다.

IndexOf(UIElement, UInt32)

지정된 항목의 인덱스를 검색합니다.

InsertAt(UInt32, UIElement)

지정된 인덱스에 지정된 항목을 삽입합니다.

Move(UInt32, UInt32)

컬렉션에서 지정한 인덱스의 항목을 새 위치로 이동합니다.

RemoveAt(UInt32)

지정된 인덱스에서 항목을 제거합니다.

RemoveAtEnd()

컬렉션의 마지막 항목을 제거합니다.

ReplaceAll(UIElement[])

처음에 컬렉션을 지운 다음 제공된 배열을 새 항목으로 삽입합니다.

SetAt(UInt32, UIElement)

지정된 인덱스에서 값을 지정된 UIElement 값으로 설정합니다.

적용 대상

추가 정보