XamlMember.DependsOn Property

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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
Available since 4.0
Return to top