New to Telerik UI for WinFormsStart a free 30-day trial

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 INotifyPropertyChanged with enhanced RadPropertyChanged events providing detailed change information. Through 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.

Definition

Constructors

Initializes a new instance of the RadObject class, setting up the property value collection and object type information.

C#
public RadObject()

Fields

C#
public static RadProperty BindingContextProperty
C#
public static readonly RadObjectType RadType

Properties

Gets or sets the BindingContext for this object, which provides the foundation for data binding operations and can be inherited from parent objects.

C#
[Browsable(false)]
public virtual BindingContext BindingContext { get; set; }

Gets or sets a Filter instance used to filter the property collection returned by GetProperties().

C#
[Browsable(false)]
public Filter PropertyFilter { get; set; }

Gets a collection containing property values.

C#
public RadPropertyValueCollection PropertyValues { get; }

Gets the RadObjectType associated with this object's system type, providing metadata and property registration information.

C#
[Browsable(false)]
public RadObjectType RadObjectType { get; }

Methods

Registers a style setting for this instance.

C#
protected virtual ValueUpdateResult AddStylePropertySetting(IPropertySetting setting)
Parameters:settingIPropertySettingReturns:

ValueUpdateResult

Binds the specified property to a property of the provided binding source object.

C#
public ValueUpdateResult BindProperty(RadProperty propertyToBind, RadObject sourceObject, RadProperty sourceProperty, PropertyBindingOptions options)
Parameters:propertyToBindRadProperty

Our property that is about to be bound.

sourceObjectRadObject

The object to which source property belongs.

sourcePropertyRadProperty

The property to which we will bind.

optionsPropertyBindingOptions

Additional options, specifying the binding operation.

Returns:

ValueUpdateResult

Determines whether the object can raise PropertyChanging and PropertyChanged notifications. Current implementation checks whether the object is disposing or is already disposed of.

C#
protected virtual bool CanRaisePropertyChangeNotifications(RadPropertyValue propVal)
Parameters:propValRadPropertyValueReturns:

bool

Removes all references to external property modifiers such as property bindings, style settings, and animations to prepare for disposal.

C#
protected virtual void ClearPropertyStore()

Allows inheritors to force a coersion of the current calculated value for the given property.

C#
protected virtual object CoerceValue(RadPropertyValue propVal, object baseValue)
Parameters:propValRadPropertyValue

The property value.

baseValueobject

The current caluclated value of the property.

Returns:

object

Null if no coersion is needed.

Releases managed resources by clearing the property store and disposing value animators to prevent memory leaks.

C#
protected override void DisposeManagedResources()

Overrides: DisposableObject.DisposeManagedResources()

Allows inheritors to provide custom default value.

C#
protected virtual object GetDefaultValue(RadPropertyValue propVal, object baseDefaultValue)
Parameters:propValRadPropertyValuebaseDefaultValueobjectReturns:

object

Searches up in the chain of InheritanceParents for a value for the specified property.

C#
protected virtual object GetInheritedValue(RadProperty property)
Parameters:propertyRadProperty

The property to examine.

Returns:

object

Gets the RadPropertyValue structure that contains information about the specified property's effective value for this instance, including value source and composition details.

C#
public RadPropertyValue GetPropertyValue(RadProperty property)
Parameters:propertyRadProperty

The RadProperty for which to retrieve the property value information.

Returns:

RadPropertyValue

The RadPropertyValue structure, or null if no effective value is recorded.

Gets the registered RadProperty with the specified name for this object's type, enabling dynamic property access by name.

C#
public RadProperty GetRegisteredRadProperty(string propertyName)
Parameters:propertyNamestring

The name of the property to retrieve.

Returns:

RadProperty

The RadProperty with the specified name, or null if no such property is registered.

Retrieves the current effective value for the specified RadProperty, resolving through the property value composition hierarchy.

C#
public virtual object GetValue(RadProperty property)
Parameters:propertyRadProperty

The RadProperty for which to retrieve the current value.

Returns:

object

The current effective value of the property, which may come from local, style, inherited, or default value sources.

Gets the ValueSource that currently provides the effective value for the specified property (Local, Style, Inherited, or Default).

C#
public ValueSource GetValueSource(RadProperty property)
Parameters:propertyRadProperty

The RadProperty for which to determine the value source.

Returns:

ValueSource

A ValueSource indicating which source is providing the current effective value.

Determines whether the specified property may be canceled.

C#
protected virtual bool IsPropertyCancelable(RadPropertyMetadata metadata)
Parameters:metadataRadPropertyMetadata

The metadata associated with the property change.

Returns:

bool

Raises the standard .NET PropertyChanged event to notify subscribers of property value changes using the provided event arguments.

C#
protected virtual void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
Parameters:ePropertyChangedEventArgs

The PropertyChangedEventArgs containing the property change information.

Raises the standard .NET PropertyChanged event with the specified property name to notify subscribers of property value changes.

C#
protected virtual void OnNotifyPropertyChanged(string propertyName)
Parameters:propertyNamestring

The name of the property that changed.

Raises the RadPropertyChanged event and the standard .NET PropertyChanged event to notify subscribers of property value changes.

C#
protected virtual void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters:eRadPropertyChangedEventArgs

The RadPropertyChangedEventArgs containing information about the property change.

Raises the RadPropertyChanging event, allowing subscribers to be notified before a property value changes and potentially cancel the change.

C#
protected virtual void OnPropertyChanging(RadPropertyChangingEventArgs args)
Parameters:argsRadPropertyChangingEventArgs

The RadPropertyChangingEventArgs containing information about the property change.

C#
protected virtual void OnShouldSerializeProperty(ShouldSerializePropertyEventArgs args)
Parameters:argsShouldSerializePropertyEventArgs

Replaces the default property descriptors of object properties to perform RadObject-specific tasks like checking ShouldSerialize and RadProperty default values.

C#
protected virtual PropertyDescriptorCollection ReplaceDefaultDescriptors(PropertyDescriptorCollection props)
Parameters:propsPropertyDescriptorCollection

The original PropertyDescriptorCollection to replace.

Returns:

PropertyDescriptorCollection

A new PropertyDescriptorCollection with custom RadObject-aware property descriptors.

Resets only the local value of the specified property while preserving other value sources like styles, inheritance, and default values.

C#
public virtual ValueUpdateResult ResetLocalValue(RadProperty property)
Parameters:propertyRadProperty

The RadProperty for which to reset only the local value.

Returns:

ValueUpdateResult

A ValueUpdateResult indicating the result of the operation.

Resets the current value of the specified property using the provided flags.

C#
public ValueUpdateResult ResetValue(RadProperty property, ValueResetFlags flags)
Parameters:propertyRadProperty

The RadProperty that should be reset.

flagsValueResetFlags

Additional flags that specify which effective modifiers should be reset.

Returns:

ValueUpdateResult

The result of the operation.

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.

C#
public ValueUpdateResult ResetValue(RadProperty property)
Parameters:propertyRadProperty

The RadProperty to reset to its default state.

Returns:

ValueUpdateResult

A ValueUpdateResult indicating the result of the operation.

Resets the specified property value, using the provided reset flags.

C#
protected virtual ValueUpdateResult ResetValueCore(RadPropertyValue propVal, ValueResetFlags flags)
Parameters:propValRadPropertyValueflagsValueResetFlagsReturns:

ValueUpdateResult

The result of the operation.

Resumes property change notifications after a previous SuspendPropertyNotifications() call, restoring normal notification behavior when the suspension count reaches zero.

C#
public void ResumePropertyNotifications()

Sets a default value override for the specified property, replacing the default value provided by the property's metadata with a custom value.

C#
public ValueUpdateResult SetDefaultValueOverride(RadProperty property, object value)
Parameters:propertyRadProperty

The RadProperty for which to set the default value override.

valueobject

The value to use as the new default, overriding the metadata-defined default value.

Returns:

ValueUpdateResult

A ValueUpdateResult indicating the result of the operation.

Sets a local value for the specified RadProperty, establishing the highest priority value in the property value composition hierarchy.

C#
public ValueUpdateResult SetValue(RadProperty property, object value)
Parameters:propertyRadProperty

The RadProperty for which to set the local value.

valueobject

The value to set as the local value for the property.

Returns:

ValueUpdateResult

A ValueUpdateResult indicating the result of the operation.

Performs the core logic of updating property value.

C#
protected virtual ValueUpdateResult SetValueCore(RadPropertyValue propVal, object propModifier, object newValue, ValueSource source)
Parameters:propValRadPropertyValue

The property value structure, holding property information.

propModifierobject

Additional modifier, like IPropertySetting

newValueobject

The actual new value to be set, valid for Local and DefaultValue sources.

sourceValueSource

Specifies the source of the provided new value.

Returns:

ValueUpdateResult

The result of the operation.

Determines whether the specified RadProperty should be serialized. Prevents theme and default values serialization.

C#
public virtual bool ShouldSerializeProperty(RadProperty property)
Parameters:propertyRadProperty

The RadProperty that is about to be serialized.

Returns:

bool

A value indicating whether to serialize the property value.

Temporarily suspends property change notifications to improve performance during bulk property updates. Must be paired with ResumePropertyNotifications() to restore normal notification behavior.

C#
public void SuspendPropertyNotifications()

Removes the property binding for the specified property, restoring the property to use local, style, inherited, or default values.

C#
public ValueUpdateResult UnbindProperty(RadProperty boundProperty)
Parameters:boundPropertyRadProperty

The RadProperty for which to remove the binding.

Returns:

ValueUpdateResult

A ValueUpdateResult indicating the result of the operation.

Forces re-evaluation of the current value for the specified property, triggering value composition and change notifications if the value changes.

C#
public ValueUpdateResult UpdateValue(RadProperty property)
Parameters:propertyRadProperty

The RadProperty for which to force value re-evaluation.

Returns:

ValueUpdateResult

A ValueUpdateResult indicating the result of the operation.

Performs the core value update logic.

C#
protected virtual ValueUpdateResult UpdateValueCore(RadPropertyValue propVal)
Parameters:propValRadPropertyValueReturns:

ValueUpdateResult

The result of the operation.

Events

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 INotifyPropertyChanged API.

C#
[Browsable(false)]
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged

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.

C#
[Browsable(false)]
public event RadPropertyChangedEventHandler RadPropertyChanged

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.

C#
[Browsable(false)]
public event RadPropertyChangingEventHandler RadPropertyChanging

Extension Methods