RadProperty
Represents a dependency property definition in the Telerik Presentation Framework, providing the foundation for the advanced property system that enables theming, styling, inheritance, and data binding throughout the framework.
Definition
Namespace:Telerik.WinControls
Assembly:Telerik.WinControls.dll
Syntax:
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RadProperty
Inheritance: objectRadProperty
Fields
public static readonly object UnsetValue
Properties
public int GlobalIndex { get; }
Gets the name of this property.
public string Name { get; }
The string name that uniquely identifies this property within its owner type. This is the same name used when registering the property.
Property names must be unique within their owner type hierarchy. The name is used for property lookup operations and debugging. Once a property is registered, its name cannot be changed.
Gets the type that owns this property definition.
public Type OwnerType { get; }
The Type that originally registered this property. This is typically the type where the property was first defined, though the property may be inherited by derived types.
The owner type is set when the property is registered through Register(string, Type, Type, RadPropertyMetadata) or RegisterAttached(string, Type, Type, RadPropertyMetadata). Derived types can add metadata through AddOwner(Type) but the original owner type remains unchanged.
Gets the type of values that can be stored in this property.
public Type PropertyType { get; }
The Type that represents the data type of this property. All values assigned to this property must be compatible with this type.
This is the type specified when the property was registered through Register(string, Type, Type, RadPropertyMetadata) or RegisterAttached(string, Type, Type, RadPropertyMetadata). The property system uses this type for validation and type checking during value assignment and retrieval operations.
public bool PropertyTypeIsValueType { get; }
public ValidateValueCallback ValidateValueCallback { get; }
Methods
public RadProperty AddOwner(Type ownerType, RadPropertyMetadata typeMetadata)
public RadPropertyMetadata GetMetadata(RadObject radObject)
public RadPropertyMetadata GetMetadata(RadObjectType radObjectType)
Determines whether the specified value is type-compatible with this property.
public bool IsValidType(object value)
The value to check for type compatibility.
Returns:True if the value is type-compatible; otherwise, false.
This method only checks type compatibility and does not invoke custom validation callbacks. Use IsValidValue for complete validation including custom validation logic.
Determines whether the specified value is valid for this property on the given instance.
public bool IsValidValue(object value, RadObject instance)
The value to validate.
instanceRadObjectThe RadObject instance where the value would be applied.
Returns:True if the value is valid; otherwise, false.
This method performs both type checking and custom validation. It first verifies that the value is compatible with the property type, then calls the ValidateValueCallback if one was specified during property registration.
public void OverrideMetadata(Type forType, RadPropertyMetadata typeMetadata)
Registers a new dependency property with metadata and a validation callback.
public static RadProperty Register(string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback)
The name of the property to register.
propertyTypeTypeThe type of the property value.
ownerTypeTypeThe type that owns this property.
typeMetadataRadPropertyMetadataProperty metadata including default value, inheritance behavior, and callbacks.
validateValueCallbackValidateValueCallbackA callback method to validate property values before they are set.
Returns:A RadProperty identifier that can be used to set or get property values.
This overload provides validation capabilities, allowing you to verify property values before they are assigned. The validation callback is called for every value assignment and should return true for valid values, false for invalid ones.
Registers a new dependency property with the specified metadata.
public static RadProperty Register(string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata)
The name of the property to register.
propertyTypeTypeThe type of the property value.
ownerTypeTypeThe type that owns this property.
typeMetadataRadPropertyMetadataProperty metadata including default value, inheritance behavior, and callbacks.
Returns:A RadProperty identifier that can be used to set or get property values.
This is the primary method for registering properties that belong to a specific type. The property can be accessed only through instances of the ownerType or its derived types. Use RegisterAttached(string, Type, Type, RadPropertyMetadata) for properties that can be applied to any RadObject.
Registers an attached property with validation capabilities.
public static RadProperty RegisterAttached(string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback)
The name of the attached property to register.
propertyTypeTypeThe type of the property value.
ownerTypeTypeThe type that defines this attached property.
typeMetadataRadPropertyMetadataProperty metadata including default value and callbacks.
validateValueCallbackValidateValueCallbackA callback method to validate property values before they are set.
Returns:A RadProperty identifier for the attached property.
This overload combines attached property functionality with value validation, ensuring that only valid values can be assigned to the property regardless of which RadObject instance the property is applied to.
Registers an attached property that can be applied to any RadObject instance.
public static RadProperty RegisterAttached(string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata)
The name of the attached property to register.
propertyTypeTypeThe type of the property value.
ownerTypeTypeThe type that defines this attached property.
typeMetadataRadPropertyMetadataProperty metadata including default value and callbacks.
Returns:A RadProperty identifier for the attached property.
Attached properties are a special kind of property that can be set on any RadObject, not just instances of the ownerType. This is useful for layout properties, styling hints, and other cross-cutting concerns that need to be applied broadly.