Share via


RelativeSource.AncestorType Özellik

Tanım

Aranacak ata türünü alır veya ayarlar.

public:
 property Type ^ AncestorType { Type ^ get(); void set(Type ^ value); };
public Type AncestorType { get; set; }
member this.AncestorType : Type with get, set
Public Property AncestorType As Type

Özellik Değeri

Ata türü. null varsayılan değerdir.

Özel durumlar

Örnekler

Aşağıdaki, bağlamanın hedef öğesinden başlayarak yukarı doğru yolda karşılaşılan ikinciyi ItemsControl döndürür.

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)

Açıklamalar

Mode Özellik açıkça ayarlanmadıysa, veya AncestorLevel özelliğinin ayarlanması AncestorType özellik değerini FindAncestorörtük olarak olarak kilitlerMode.

XAML Metni Kullanımı

XAML bilgileri için bkz . RelativeSource MarkupExtension.

Şunlara uygulanır

Ayrıca bkz.