Class RadObject
Serves as the foundational base class for all objects in the Telerik Presentation Framework, implementing a sophisticated dependency property system inspired by WPF's property model. RadObject provides the core infrastructure for the TPF property system with multi-layered property values, automatic change notifications, and property inheritance. The system supports multiple value sources with precedence: Local Values (highest), Style Values, Inherited Values, and Default Values. Implements System.ComponentModel.INotifyPropertyChanged with enhanced RadPropertyChanged events providing detailed change information. Through System.ComponentModel.ICustomTypeDescriptor, it provides custom type information for designer support and property serialization. The property system includes comprehensive APIs (GetValue, SetValue, ResetValue, ClearValue) with priority-based resolution, validation callbacks, and efficient storage. Extends DisposableObject for proper resource cleanup and serves as the foundation for all TPF classes.
Inherited Members
Namespace: Telerik.WinControls
Assembly: Telerik.WinControls.dll
Syntax
public class RadObject : DisposableObject, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor
Constructors
RadObject()
Initializes a new instance of the RadObject class, setting up the property value collection and object type information.
Declaration
public RadObject()
Fields
BindingContextProperty
RadType
Properties
BindingContext
Gets or sets the BindingContext for this object, which provides the foundation for data binding operations and can be inherited from parent objects.
Declaration
[RadPropertyDefaultValue("BindingContext", typeof(RadObject))]
public virtual BindingContext BindingContext { get; set; }
Property Value
|
System.Windows.Forms.BindingContext
|
IsDesignMode
This property is not relevant for this class.
Declaration
public virtual bool IsDesignMode { get; set; }
Property Value
|
System.Boolean
|
PropertyFilter
Gets or sets a Filter instance used to filter the property collection returned by System.ComponentModel.ICustomTypeDescriptor.GetProperties.
Declaration
public Filter PropertyFilter { get; set; }
Property Value
|
Filter
|
PropertyValues
Gets a collection containing property values.
Declaration
public RadPropertyValueCollection PropertyValues { get; }
Property Value
|
RadPropertyValueCollection
|
RadObjectType
Gets the RadObjectType associated with this object's system type, providing metadata and property registration information.
Declaration
public RadObjectType RadObjectType { get; }
Property Value
|
RadObjectType
|
Methods
AddStylePropertySetting(IPropertySetting)
Registers a style setting for this instance.
Declaration
protected virtual ValueUpdateResult AddStylePropertySetting(IPropertySetting setting)
Parameters
|
IPropertySetting
setting
|
Returns
|
ValueUpdateResult
|
BindProperty(RadProperty, RadObject, RadProperty, PropertyBindingOptions)
Binds the specified property to a property of the provided binding source object.
Declaration
public ValueUpdateResult BindProperty(RadProperty propertyToBind, RadObject sourceObject, RadProperty sourceProperty, PropertyBindingOptions options)
Parameters
|
RadProperty
propertyToBind
Our property that is about to be bound. |
|
RadObject
sourceObject
The object to which source property belongs. |
|
RadProperty
sourceProperty
The property to which we will bind. |
|
PropertyBindingOptions
options
Additional options, specifying the binding operation. |
Returns
|
ValueUpdateResult
|
CanRaisePropertyChangeNotifications(RadPropertyValue)
Determines whether the object can raise PropertyChanging and PropertyChanged notifications. Current implementation checks whether the object is disposing or is already disposed of.
Declaration
protected virtual bool CanRaisePropertyChangeNotifications(RadPropertyValue propVal)
Parameters
|
RadPropertyValue
propVal
|
Returns
|
System.Boolean
|
ClearPropertyStore()
Removes all references to external property modifiers such as property bindings, style settings, and animations to prepare for disposal.
Declaration
protected virtual void ClearPropertyStore()
CoerceValue(RadPropertyValue, Object)
Allows inheritors to force a coersion of the current calculated value for the given property.
Declaration
protected virtual object CoerceValue(RadPropertyValue propVal, object baseValue)
Parameters
|
RadPropertyValue
propVal
The property value. |
|
System.Object
baseValue
The current caluclated value of the property. |
Returns
|
System.Object
Null if no coersion is needed. |
DisposeManagedResources()
Releases managed resources by clearing the property store and disposing value animators to prevent memory leaks.
Declaration
protected override void DisposeManagedResources()
Overrides
GetDefaultValue(RadPropertyValue, Object)
Allows inheritors to provide custom default value.
Declaration
protected virtual object GetDefaultValue(RadPropertyValue propVal, object baseDefaultValue)
Parameters
|
RadPropertyValue
propVal
|
|
System.Object
baseDefaultValue
|
Returns
|
System.Object
|
GetInheritedValue(RadProperty)
Searches up in the chain of InheritanceParents for a value for the specified property.
Declaration
protected virtual object GetInheritedValue(RadProperty property)
Parameters
|
RadProperty
property
The property to examine. |
Returns
|
System.Object
|
GetPropertyValue(RadProperty)
Gets the RadPropertyValue structure that contains information about the specified property's effective value for this instance, including value source and composition details.
Declaration
public RadPropertyValue GetPropertyValue(RadProperty property)
Parameters
|
RadProperty
property
The RadProperty for which to retrieve the property value information. |
Returns
|
RadPropertyValue
The RadPropertyValue structure, or null if no effective value is recorded. |
GetRegisteredRadProperty(String)
Gets the registered RadProperty with the specified name for this object's type, enabling dynamic property access by name.
Declaration
public RadProperty GetRegisteredRadProperty(string propertyName)
Parameters
|
System.String
propertyName
The name of the property to retrieve. |
Returns
|
RadProperty
The RadProperty with the specified name, or null if no such property is registered. |
GetValue(RadProperty)
Retrieves the current effective value for the specified RadProperty, resolving through the property value composition hierarchy.
Declaration
public virtual object GetValue(RadProperty property)
Parameters
|
RadProperty
property
The RadProperty for which to retrieve the current value. |
Returns
|
System.Object
The current effective value of the property, which may come from local, style, inherited, or default value sources. |
GetValueSource(RadProperty)
Gets the ValueSource that currently provides the effective value for the specified property (Local, Style, Inherited, or Default).
Declaration
public ValueSource GetValueSource(RadProperty property)
Parameters
|
RadProperty
property
The RadProperty for which to determine the value source. |
Returns
|
ValueSource
A ValueSource indicating which source is providing the current effective value. |
IsPropertyCancelable(RadPropertyMetadata)
Determines whether the specified property may be canceled.
Declaration
protected virtual bool IsPropertyCancelable(RadPropertyMetadata metadata)
Parameters
|
RadPropertyMetadata
metadata
The metadata associated with the property change. |
Returns
|
System.Boolean
|
OnNotifyPropertyChanged(PropertyChangedEventArgs)
Raises the standard .NET PropertyChanged event to notify subscribers of property value changes using the provided event arguments.
Declaration
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters
|
System.ComponentModel.PropertyChangedEventArgs
e
The System.ComponentModel.PropertyChangedEventArgs containing the property change information. |
OnNotifyPropertyChanged(String)
Raises the standard .NET PropertyChanged event with the specified property name to notify subscribers of property value changes.
Declaration
protected virtual void OnNotifyPropertyChanged(string propertyName)
Parameters
|
System.String
propertyName
The name of the property that changed. |
OnPropertyChanged(RadPropertyChangedEventArgs)
Raises the RadPropertyChanged event and the standard .NET PropertyChanged event to notify subscribers of property value changes.
Declaration
protected virtual void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters
|
RadPropertyChangedEventArgs
e
The RadPropertyChangedEventArgs containing information about the property change. |
OnPropertyChanging(RadPropertyChangingEventArgs)
Raises the RadPropertyChanging event, allowing subscribers to be notified before a property value changes and potentially cancel the change.
Declaration
protected virtual void OnPropertyChanging(RadPropertyChangingEventArgs args)
Parameters
|
RadPropertyChangingEventArgs
args
The RadPropertyChangingEventArgs containing information about the property change. |
OnShouldSerializeProperty(ShouldSerializePropertyEventArgs)
Declaration
protected virtual void OnShouldSerializeProperty(ShouldSerializePropertyEventArgs args)
Parameters
|
ShouldSerializePropertyEventArgs
args
|
RemoveStylePropertySetting(IPropertySetting)
This method is not relevant for this class.
Declaration
public virtual void RemoveStylePropertySetting(IPropertySetting setting)
Parameters
|
IPropertySetting
setting
The property setting to remove. |
RemoveStylePropertySetting(RadProperty)
This method is not relevant for this class.
Declaration
public void RemoveStylePropertySetting(RadProperty property)
Parameters
|
RadProperty
property
The property for which to remove the style setting. |
ReplaceDefaultDescriptors(PropertyDescriptorCollection)
Replaces the default property descriptors of object properties to perform RadObject-specific tasks like checking ShouldSerialize and RadProperty default values.
Declaration
protected virtual PropertyDescriptorCollection ReplaceDefaultDescriptors(PropertyDescriptorCollection props)
Parameters
|
System.ComponentModel.PropertyDescriptorCollection
props
The original System.ComponentModel.PropertyDescriptorCollection to replace. |
Returns
|
System.ComponentModel.PropertyDescriptorCollection
A new System.ComponentModel.PropertyDescriptorCollection with custom RadObject-aware property descriptors. |
ResetLocalValue(RadProperty)
Resets only the local value of the specified property while preserving other value sources like styles, inheritance, and default values.
Declaration
public virtual ValueUpdateResult ResetLocalValue(RadProperty property)
Parameters
|
RadProperty
property
The RadProperty for which to reset only the local value. |
Returns
|
ValueUpdateResult
A ValueUpdateResult indicating the result of the operation. |
ResetValue(RadProperty)
Resets the current value of the specified property by removing all effective value modifiers (local, style, animation) and reverting to the inherited or default value.
Declaration
public ValueUpdateResult ResetValue(RadProperty property)
Parameters
|
RadProperty
property
The RadProperty to reset to its default state. |
Returns
|
ValueUpdateResult
A ValueUpdateResult indicating the result of the operation. |
ResetValue(RadProperty, ValueResetFlags)
Resets the current value of the specified property using the provided flags.
Declaration
public ValueUpdateResult ResetValue(RadProperty property, ValueResetFlags flags)
Parameters
|
RadProperty
property
The RadProperty that should be reset. |
|
ValueResetFlags
flags
Additional flags that specify which effective modifiers should be reset. |
Returns
|
ValueUpdateResult
The result of the operation. |
ResetValueCore(RadPropertyValue, ValueResetFlags)
Resets the specified property value, using the provided reset flags.
Declaration
protected virtual ValueUpdateResult ResetValueCore(RadPropertyValue propVal, ValueResetFlags flags)
Parameters
|
RadPropertyValue
propVal
|
|
ValueResetFlags
flags
|
Returns
|
ValueUpdateResult
The result of the operation. |
ResumePropertyNotifications()
Resumes property change notifications after a previous SuspendPropertyNotifications() call, restoring normal notification behavior when the suspension count reaches zero.
Declaration
public void ResumePropertyNotifications()
SetDefaultValueOverride(RadProperty, Object)
Sets a default value override for the specified property, replacing the default value provided by the property's metadata with a custom value.
Declaration
public ValueUpdateResult SetDefaultValueOverride(RadProperty property, object value)
Parameters
|
RadProperty
property
The RadProperty for which to set the default value override. |
|
System.Object
value
The value to use as the new default, overriding the metadata-defined default value. |
Returns
|
ValueUpdateResult
A ValueUpdateResult indicating the result of the operation. |
SetValue(RadProperty, Object)
Sets a local value for the specified RadProperty, establishing the highest priority value in the property value composition hierarchy.
Declaration
public ValueUpdateResult SetValue(RadProperty property, object value)
Parameters
|
RadProperty
property
The RadProperty for which to set the local value. |
|
System.Object
value
The value to set as the local value for the property. |
Returns
|
ValueUpdateResult
A ValueUpdateResult indicating the result of the operation. |
SetValueAtDesignTime(RadProperty, Object)
Applies the specified value as Local for the desired property and raises the flag IsLocalValueSetAtDesignTime for that property. All design-time direct property modifications (e.g. item.Text = "Item1") should be done through this method for the property to be properly serialized. If a property is modified through a property grid, the custom property descriptor will automatically apply this logic. This method is used internally. This method is not relevant for this class.
Declaration
public void SetValueAtDesignTime(RadProperty property, object value)
Parameters
|
RadProperty
property
|
|
System.Object
value
|
SetValueCore(RadPropertyValue, Object, Object, ValueSource)
Performs the core logic of updating property value.
Declaration
protected virtual ValueUpdateResult SetValueCore(RadPropertyValue propVal, object propModifier, object newValue, ValueSource source)
Parameters
|
RadPropertyValue
propVal
The property value structure, holding property information. |
|
System.Object
propModifier
Additional modifier, like IPropertySetting |
|
System.Object
newValue
The actual new value to be set, valid for Local and DefaultValue sources. |
|
ValueSource
source
Specifies the source of the provided new value. |
Returns
|
ValueUpdateResult
The result of the operation. |
ShouldSerializeProperty(PropertyDescriptor)
Determines whether the property defined by the provided property descriptor should be serialized.
Declaration
public virtual bool? ShouldSerializeProperty(PropertyDescriptor property)
Parameters
|
System.ComponentModel.PropertyDescriptor
property
|
Returns
|
System.Nullable<System.Boolean>
|
ShouldSerializeProperty(RadProperty)
Determines whether the specified RadProperty should be serialized. Prevents theme and default values serialization.
Declaration
public virtual bool ShouldSerializeProperty(RadProperty property)
Parameters
|
RadProperty
property
The RadProperty that is about to be serialized. |
Returns
|
System.Boolean
A value indicating whether to serialize the property value. |
SuspendPropertyNotifications()
Temporarily suspends property change notifications to improve performance during bulk property updates. Must be paired with ResumePropertyNotifications() to restore normal notification behavior.
Declaration
public void SuspendPropertyNotifications()
UnbindProperty(RadProperty)
Removes the property binding for the specified property, restoring the property to use local, style, inherited, or default values.
Declaration
public ValueUpdateResult UnbindProperty(RadProperty boundProperty)
Parameters
|
RadProperty
boundProperty
The RadProperty for which to remove the binding. |
Returns
|
ValueUpdateResult
A ValueUpdateResult indicating the result of the operation. |
UpdateValue(RadProperty)
Forces re-evaluation of the current value for the specified property, triggering value composition and change notifications if the value changes.
Declaration
public ValueUpdateResult UpdateValue(RadProperty property)
Parameters
|
RadProperty
property
The RadProperty for which to force value re-evaluation. |
Returns
|
ValueUpdateResult
A ValueUpdateResult indicating the result of the operation. |
UpdateValueCore(RadPropertyValue)
Performs the core value update logic.
Declaration
protected virtual ValueUpdateResult UpdateValueCore(RadPropertyValue propVal)
Parameters
|
RadPropertyValue
propVal
|
Returns
|
ValueUpdateResult
The result of the operation. |
Events
PropertyChanged
Occurs when a property value changes, providing standard .NET property change notification. For RadProperty changes, the system automatically raises this event. For non-RadProperty changes, developers must manually fire this event using the System.ComponentModel.INotifyPropertyChanged API.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
|
System.ComponentModel.PropertyChangedEventHandler
|
RadPropertyChanged
Occurs when a RadProperty value changes, providing enhanced property change information including old and new values, metadata, and value source details specific to the Telerik property system.
Declaration
public event RadPropertyChangedEventHandler RadPropertyChanged
Event Type
|
RadPropertyChangedEventHandler
|
RadPropertyChanging
Occurs before a RadProperty value changes, allowing cancellation of the property change operation and providing access to the proposed new value before it is applied.
Declaration
public event RadPropertyChangingEventHandler RadPropertyChanging
Event Type
|
RadPropertyChangingEventHandler
|
ShouldSerializePropertyHandler
This event is not relevant for this class.
Declaration
public event ShouldSerializePropertyEventHandler ShouldSerializePropertyHandler
Event Type
|
ShouldSerializePropertyEventHandler
|