RelativeSource.AncestorType Propriedade

Definição

Obtém ou define o tipo de antepassado a procurar.

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

Valor de Propriedade

O tipo de antepassado. O valor predefinido é null.

Exceções

Exemplos

O seguinte devolve o segundo ItemsControl encontrado no caminho ascendente começando no elemento alvo da ligação.

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)

Observações

Se a Mode propriedade não for definida explicitamente, definir o AncestorType ou a AncestorLevel propriedade irá implicitamente bloquear o Mode valor da propriedade a FindAncestor.

Utilização de Texto XAML

Para informações sobre XAML, consulte RelativeSource MarkupExtension.

Aplica-se a

Ver também