編輯

共用方式為


XamlMember.DependsOn Property

Definition

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

public:
 property System::Collections::Generic::IList<System::Xaml::XamlMember ^> ^ DependsOn { System::Collections::Generic::IList<System::Xaml::XamlMember ^> ^ get(); };
public System.Collections.Generic.IList<System.Xaml.XamlMember> DependsOn { get; }
member this.DependsOn : System.Collections.Generic.IList<System.Xaml.XamlMember>
Public ReadOnly Property DependsOn As IList(Of XamlMember)

Property Value

A list of XamlMember objects.

Remarks

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.

Applies to

See also