Esta documentación está archivada y no tiene mantenimiento.

DependencyProperty.RegisterAttachedReadOnly (Método) (String, Type, Type, PropertyMetadata)

Registers a read-only attached property, with the specified property type, owner type, and property metadata.

Espacio de nombres: System.Windows
Ensamblado: WindowsBase (en windowsbase.dll)

public static DependencyPropertyKey RegisterAttachedReadOnly (
	string name,
	Type propertyType,
	Type ownerType,
	PropertyMetadata defaultMetadata
)
public static DependencyPropertyKey RegisterAttachedReadOnly (
	String name, 
	Type propertyType, 
	Type ownerType, 
	PropertyMetadata defaultMetadata
)
public static function RegisterAttachedReadOnly (
	name : String, 
	propertyType : Type, 
	ownerType : Type, 
	defaultMetadata : PropertyMetadata
) : DependencyPropertyKey
No se pueden utilizar métodos en XAML.

Parámetros

name

The name of the dependency property to register.

propertyType

The type of the property.

ownerType

The owner type that is registering the dependency property.

defaultMetadata

Property metadata for the dependency property.

Valor devuelto

A dependency property key that should be used to set the value of a static read-only field in your class, which is then used to reference the dependency property later.

This method returns the type DependencyPropertyKey, whereas RegisterAttached returns the type DependencyProperty. Typically, the keys that represent read-only properties are not made public, because the keys can be used to set the dependency property value by calling SetValue(DependencyPropertyKey,Object). Your class design will affect your requirements, but it is generally recommended to limit the access and visibility of any DependencyPropertyKey to only those parts of your code that are necessary to set that dependency property as part of class or application logic. It is also recommended that you expose a dependency property identifier for the read-only dependency property, by exposing the value of DependencyPropertyKey.DependencyProperty as a public static readonly field on your class.

Read-only attached properties are a rare scenario, because the primary scenario for an attached property is its use in XAML. Without a public setter, an attached property cannot be set in XAML syntax.

For more information on dependency property registration, see DependencyProperty.

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

.NET Framework

Compatible con: 3.0
Mostrar: