RelativeSource.AncestorLevel 속성

정의

FindAncestor 모드에서 찾을 상위 항목의 수준을 가져오거나 설정합니다. 1은 바인딩 대상 요소에 가장 가까운 항목을 나타냅니다.

public:
 property int AncestorLevel { int get(); void set(int value); };
public int AncestorLevel { get; set; }
member this.AncestorLevel : int with get, set
Public Property AncestorLevel As Integer

속성 값

Int32

상위 항목 수준입니다. 1은 바인딩 대상 요소에 가장 가까운 항목을 나타냅니다.

예제

다음 두 번째 반환 ItemsControl 바인딩 대상 요소부터 위쪽 경로에 오류가 발생 했습니다.

Binding myBinding = new Binding();
// Returns the second ItemsControl encountered on the upward path
// starting at the target element of the binding
myBinding.RelativeSource = new RelativeSource(
    RelativeSourceMode.FindAncestor, typeof(ItemsControl), 2);
Dim myBinding As New Binding()
' Returns the second ItemsControl encountered on the upward path
' starting at the target element of the binding
myBinding.RelativeSource = New RelativeSource(RelativeSourceMode.FindAncestor, GetType(ItemsControl), 2)

설명

경우는 Mode 속성이 설정 되지 않으면 명시적으로 설정 합니다 AncestorType 또는 AncestorLevel 속성을 암시적으로 잠깁니다를 Mode 속성 값을 FindAncestor입니다.

XAML 텍스트 사용

XAML 정보는 RelativeSource MarkupExtension을 참조하세요.

적용 대상

추가 정보