Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DependsOn Property

XamlMember.DependsOn Property

.NET Framework 4.6 and 4.5

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
Show:
© 2015 Microsoft