This documentation is archived and is not being maintained.

ConstructorArgumentAttribute Class

Specifies that the property that this attribute is assigned to can be initialized by using a nondefault constructor parameter of the specified name. This information is primarily for serialization.

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

[AttributeUsageAttribute(AttributeTargets.Property, AllowMultiple = false, 
	Inherited = false)]
public sealed class ConstructorArgumentAttribute : Attribute
You cannot directly create an instance of this class in XAML.

This attribute specifies that the associated property can be initialized by a constructor parameter and should be ignored for serialization if the constructor is used to construct the instance. This provides better round trip representations for markup extensions that were originally created by markup extension constructor syntax rather than default constructor plus specific attributes.

In order to be valid, a markup extension public nondefault constructor must support at least one parameter. The name of the parameter must correspond to a read/write property that might otherwise be used as a serialization choice. You use this attribute to create the correspondence between the name of the parameter in the constructor by applying this attribute to the definition of the connecting read/write property.


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