DependencyProperty.Register Metódus

Definíció

Függőségi tulajdonságot regisztrál.

Túlterhelések

Name Description
Register(String, Type, Type)

Egy függőségi tulajdonságot regisztrál a megadott tulajdonságnévvel, tulajdonságtípussal és tulajdonostípussal.

Register(String, Type, Type, PropertyMetadata)

Egy függőségi tulajdonságot regisztrál a megadott tulajdonságnévvel, tulajdonságtípussal, tulajdonostípussal és tulajdonság metaadataival.

Register(String, Type, Type, PropertyMetadata, ValidateValueCallback)

Egy függőségi tulajdonságot regisztrál a megadott tulajdonságnévvel, tulajdonságtípussal, tulajdonostípussal, tulajdonság metaadataival és a tulajdonság értékérvényesítési visszahívásával.

Register(String, Type, Type)

Egy függőségi tulajdonságot regisztrál a megadott tulajdonságnévvel, tulajdonságtípussal és tulajdonostípussal.

public:
 static System::Windows::DependencyProperty ^ Register(System::String ^ name, Type ^ propertyType, Type ^ ownerType);
public static System.Windows.DependencyProperty Register(string name, Type propertyType, Type ownerType);
static member Register : string * Type * Type -> System.Windows.DependencyProperty
Public Shared Function Register (name As String, propertyType As Type, ownerType As Type) As DependencyProperty

Paraméterek

name
String

A regisztrálandó függőségi tulajdonság neve. A névnek egyedinek kell lennie a tulajdonostípus regisztrációs névterében.

propertyType
Type

A tulajdonság típusa.

ownerType
Type

A függőségi tulajdonságot regisztráló tulajdonostípus.

Válaszok

Függőségi tulajdonságazonosító, amelyet az osztály egy public static readonly mezőjének értékének beállításához kell használni. Ez az azonosító később hivatkozik a függőségi tulajdonságra olyan műveletek esetében, mint például az érték programozott beállítása vagy a metaadatok beszerzése.

Példák

public static readonly DependencyProperty IsDirtyProperty = DependencyProperty.Register(
  "IsDirty",
  typeof(Boolean),
  typeof(AquariumObject3)
);
Public Shared ReadOnly IsDirtyProperty As DependencyProperty = DependencyProperty.Register("IsDirty", GetType(Boolean), GetType(AquariumObject3))

Megjegyzések

A függőségi tulajdonság regisztrációval kapcsolatos további információkért lásd: DependencyProperty.

Lásd még

A következőre érvényes:

Register(String, Type, Type, PropertyMetadata)

Egy függőségi tulajdonságot regisztrál a megadott tulajdonságnévvel, tulajdonságtípussal, tulajdonostípussal és tulajdonság metaadataival.

public:
 static System::Windows::DependencyProperty ^ Register(System::String ^ name, Type ^ propertyType, Type ^ ownerType, System::Windows::PropertyMetadata ^ typeMetadata);
public static System.Windows.DependencyProperty Register(string name, Type propertyType, Type ownerType, System.Windows.PropertyMetadata typeMetadata);
static member Register : string * Type * Type * System.Windows.PropertyMetadata -> System.Windows.DependencyProperty
Public Shared Function Register (name As String, propertyType As Type, ownerType As Type, typeMetadata As PropertyMetadata) As DependencyProperty

Paraméterek

name
String

A regisztrálandó függőségi tulajdonság neve.

propertyType
Type

A tulajdonság típusa.

ownerType
Type

A függőségi tulajdonságot regisztráló tulajdonostípus.

typeMetadata
PropertyMetadata

A függőségi tulajdonság tulajdonság metaadatai.

Válaszok

Függőségi tulajdonságazonosító, amelyet az osztály egy public static readonly mezőjének értékének beállításához kell használni. Ez az azonosító később hivatkozik a függőségi tulajdonságra olyan műveletek esetében, mint például az érték programozott beállítása vagy a metaadatok beszerzése.

Megjegyzések

A függőségi tulajdonság regisztrációval kapcsolatos további információkért lásd: DependencyProperty.

Lásd még

A következőre érvényes:

Register(String, Type, Type, PropertyMetadata, ValidateValueCallback)

Egy függőségi tulajdonságot regisztrál a megadott tulajdonságnévvel, tulajdonságtípussal, tulajdonostípussal, tulajdonság metaadataival és a tulajdonság értékérvényesítési visszahívásával.

public:
 static System::Windows::DependencyProperty ^ Register(System::String ^ name, Type ^ propertyType, Type ^ ownerType, System::Windows::PropertyMetadata ^ typeMetadata, System::Windows::ValidateValueCallback ^ validateValueCallback);
public static System.Windows.DependencyProperty Register(string name, Type propertyType, Type ownerType, System.Windows.PropertyMetadata typeMetadata, System.Windows.ValidateValueCallback validateValueCallback);
static member Register : string * Type * Type * System.Windows.PropertyMetadata * System.Windows.ValidateValueCallback -> System.Windows.DependencyProperty
Public Shared Function Register (name As String, propertyType As Type, ownerType As Type, typeMetadata As PropertyMetadata, validateValueCallback As ValidateValueCallback) As DependencyProperty

Paraméterek

name
String

A regisztrálandó függőségi tulajdonság neve.

propertyType
Type

A tulajdonság típusa.

ownerType
Type

A függőségi tulajdonságot regisztráló tulajdonostípus.

typeMetadata
PropertyMetadata

A függőségi tulajdonság tulajdonság metaadatai.

validateValueCallback
ValidateValueCallback

Olyan visszahívásra való hivatkozás, amely a függőségi tulajdonság értékének bármely egyéni érvényesítését végrehajtja a tipikus típusérvényesítésen túl.

Válaszok

Függőségi tulajdonságazonosító, amelyet az osztály egy public static readonly mezőjének értékének beállításához kell használni. Ez az azonosító később hivatkozik a függőségi tulajdonságra olyan műveletek esetében, mint például az érték programozott beállítása vagy a metaadatok beszerzése.

Példák

Az alábbi példa egy függőségi tulajdonságot regisztrál, beleértve az érvényesítési visszahívást is (a visszahívás definíciója nem jelenik meg; a visszahívási definíció részleteiért lásd: ValidateValueCallback).

public static readonly DependencyProperty CurrentReadingProperty = DependencyProperty.Register(
    "CurrentReading",
    typeof(double),
    typeof(Gauge),
    new FrameworkPropertyMetadata(
        Double.NaN,
        FrameworkPropertyMetadataOptions.AffectsMeasure,
        new PropertyChangedCallback(OnCurrentReadingChanged),
        new CoerceValueCallback(CoerceCurrentReading)
    ),
    new ValidateValueCallback(IsValidReading)
);
public double CurrentReading
{
  get { return (double)GetValue(CurrentReadingProperty); }
  set { SetValue(CurrentReadingProperty, value); }
}
Public Shared ReadOnly CurrentReadingProperty As DependencyProperty =
    DependencyProperty.Register("CurrentReading",
        GetType(Double), GetType(Gauge),
        New FrameworkPropertyMetadata(Double.NaN,
            FrameworkPropertyMetadataOptions.AffectsMeasure,
            New PropertyChangedCallback(AddressOf OnCurrentReadingChanged),
            New CoerceValueCallback(AddressOf CoerceCurrentReading)),
        New ValidateValueCallback(AddressOf IsValidReading))

Public Property CurrentReading() As Double
    Get
        Return CDbl(GetValue(CurrentReadingProperty))
    End Get
    Set(ByVal value As Double)
        SetValue(CurrentReadingProperty, value)
    End Set
End Property

Megjegyzések

A függőségi tulajdonság regisztrációval kapcsolatos további információkért lásd: DependencyProperty.

Lásd még

A következőre érvényes: