RelativeSource.AncestorType Właściwość

Definicja

Pobiera lub ustawia typ przodka do wyszukania.

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

Wartość właściwości

Typ przodka. Wartość domyślna to null.

Wyjątki

Przykłady

Poniższe polecenie zwraca drugi ItemsControl napotkany na ścieżce w górę, zaczynając od elementu docelowego powiązania.

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)

Uwagi

Mode Jeśli właściwość nie zostanie jawnie ustawiona, ustawienie AncestorType właściwości lub AncestorLevel niejawnie zablokuje Mode wartość właściwości na FindAncestorwartość .

Użycie tekstu w języku XAML

Aby uzyskać informacje dotyczące języka XAML, zobacz RelativeSource MarkupExtension.

Dotyczy

Zobacz też