RelativeSource.AncestorType Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
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
O RelativeSource não está no FindAncestor modo.
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.