This documentation is archived and is not being maintained.

DependsOnAttribute Class

Specifies that the associated property is dependent on the value of another property.

Namespace:  System.Windows.Markup
Assembly:  WindowsBase (in WindowsBase.dll)

[AttributeUsageAttribute(AttributeTargets.Method|AttributeTargets.Property, AllowMultiple = true)]
public sealed class DependsOnAttribute : Attribute
You cannot directly create an instance of this class in XAML.

The Save method on XamlWriter will process the specified property before processing the property that this attribute is set on.

The Value property on the Setter class is an example of a property in Windows Presentation Foundation (WPF) that is decorated with DependsOnAttribute. Value depends on Property and TargetName being processed first. In XAML, this allows for ordering the Setter attributes in any order, but insuring that the dependent properties are processed first.

Care must be taken to avoid circular dependencies. Circular dependencies are only detected when all the properties in the cycle have been written.

DependsOnAttribute does not imply that the Type has order dependency.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0