RelativeSource.AncestorLevel Propriedade

Definição

Obtém ou define o nível do ancestral a procurar, no FindAncestor modo. Use o 1 para indicar o que está mais próximo do elemento alvo de ligação.

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

Valor de Propriedade

O nível dos antepassados. Use o 1 para indicar o que está mais próximo do elemento alvo de ligação.

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