Udostępnij za pośrednictwem


RelativeSource.AncestorLevel Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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:  System.Windows.Data
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property AncestorLevel As Integer
public int AncestorLevel { get; set; }

Property Value

Type: System.Int32
The ancestor level. Use 1 to indicate the one nearest to the binding target element.

Exceptions

Exception Condition
ArgumentOutOfRangeException

When setting this property, the specified value is less than one.

Remarks

If the Mode property is not set explicitly, setting the AncestorType or the AncestorLevel property will implicitly lock the Mode property value to FindAncestor.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.