RelativeSource |
A RelativeSource obtains an element based on its relation to the element for which RelativeSource is defined.
< Button IsVisible="{Binding Path=CurrentElement.IsClickable, Source={RelativeSource AncestorType=Container, AncestorLevel=2}}" />
Mode (default) : RelativeSourceMode
The kind of relationship the searched element has to the current element.
Allowed values:
Self makes RelativeSource return the element for which RelativeSource is defined. FindAncestor looks for a parent element of the specified type and level.
AncestorType : string
Type of parent element to look for.
AncestorLevel : int
Level of parent to look for. Can be combined with the AncestorType parameter.
{RelativeSource AncestorType=Container, AncestorLevel=2}}
In the example above, we look for a second parent of type Container.