RelativeSource.AncestorType Propriété

Définition

Obtient ou définit le type d'ancêtre à rechercher.

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

Valeur de propriété

Type

Type d'ancêtre. La valeur par défaut est null.

Exceptions

Exemples

La commande suivante retourne la seconde ItemsControl rencontrée sur le chemin vers le haut en commençant à l’élément cible de la liaison.

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)

Remarques

Si la Mode propriété n’est pas définie explicitement, la définition ou AncestorType la AncestorLevel propriété verrouille implicitement la valeur FindAncestorde la Mode propriété sur .

Utilisation du texte XAML

Pour plus d’informations XAML, consultez RelativeSource MarkupExtension.

S’applique à

Voir aussi