.NET Framework (current version)
Gets or sets the level of ancestor to look for, in
FindAncestor mode. Use 1 to indicate the one nearest to the binding target element. Namespace:
PresentationFramework (in PresentationFramework.dll)
Public Property AncestorLevel As Integer
The ancestor level. Use 1 to indicate the one nearest to the binding target element.
property is not set explicitly, setting the Mode or the AncestorType property will implicitly lock the AncestorLevel property value to Mode FindAncestor.
The following returns the second
ItemsControl encountered on the upward path starting at the target element of the binding.
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)
.NET Framework Available since 3.0 Silverlight Available since 5.0 Return to top