XamlMember.DependsOn Property

Gets a list of XamlMember objects. These report the members where dependency relationships for initialization order exist relative to this XamlMember.

Namespace:  System.Xaml
Assembly:  System.Xaml (in System.Xaml.dll)

public IList<XamlMember> DependsOn { get; }

Property Value

Type: System.Collections.Generic.IList<XamlMember>
A list of XamlMember objects.

Calling DependsOn invokes LookupDependsOn or a specific override of that method. This behavior occurs in cases where the initial internal reflection logic has not already set the information.

The DependsOn pattern can be applied to object model cases that deliberately contradict a general XAML rule. The general XAML rule is that members of a type that are not passed as initialization text (or by a factory method in XAML 2009) must be able to be assigned in any order. By applying a DependsOn pattern to a member, you can instruct XAML writers to always process the referenced member before this member. You can apply this pattern in situations where the value of the current member requires context or other information that is only available after the other member is set.

The DependsOn pattern should be applied judiciously and reserved for property scenarios where it serves an architectural purpose. Large numbers of dependencies have the potential to slow down XAML processing. Also, it is possible to produce circular dependencies, in which case the XAML processing behavior is undefined.

Example DependsOn scenarios from WPF include certain properties on ControlTemplate and DataTemplate, on Trigger, and on Setter.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft