RadDataEntryElement
Represents the main element in the RadDataEntry control hierarchy tree that encapsulates the actual data entry functionality. This element is responsible for automatically generating input controls based on data source properties and managing their layout and validation.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadDataEntryElement : RadScrollablePanelElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemRadScrollablePanelElementRadDataEntryElement...
Implements:
Inherited Members
Constructors
public RadDataEntryElement()
Fields
The error icon property that specifies the icon displayed for validation errors.
public static RadProperty ErrorIconProperty
Properties
Gets or sets a value indicating whether labels of the editors should be automatically sized to align properly in columns according to the longest text.
public bool AutoSizeLabels { get; set; }
true if labels should be auto-sized for alignment; otherwise, false.
Gets or sets the number of columns that RadDataEntry will use to arrange generated controls.
public int ColumnCount { get; set; }
The number of columns. Must be at least 1.
Exceptions:Thrown when the value is less than 1.
Gets the current object from the data source at the current position.
public object CurrentObject { get; }
The current object, or null if no object is available at the current position.
Gets or sets the data source for the RadDataEntry control.
public object DataSource { get; set; }
The data source object. Setting to null will clear all generated editors.
Gets or sets the icon used by the error provider for displaying validation errors.
[TypeConverter(typeof(ImageTypeConverter))]
public Image ErrorIcon { get; set; }
The error icon image.
Gets or sets a value indicating whether the generated editors should automatically fit their width to the width of the RadDataEntry.
public bool FitToParentWidth { get; set; }
true if editors should fit to parent width; otherwise, false to use ItemDefaultSize.
Gets or sets the flow direction for generating editors when the ColumnCount property is greater than 1.
public FlowDirection FlowDirection { get; set; }
The flow direction that determines how controls are arranged across columns.
Gets or sets the default size that generated items should have when FitToParentWidth is false. When FitToParentWidth is true, the width is calculated based on the RadDataEntry width.
public Size ItemDefaultSize { get; set; }
The default size of generated editor items, automatically scaled based on DPI settings.
Gets or sets the spacing between the generated editor items.
public int ItemSpace { get; set; }
The item space in pixels, automatically scaled based on DPI settings.
Gets the binding manager that manages the data binding for the current data source.
public BindingManagerBase Manager { get; }
The BindingManagerBase instance associated with the data source.
Methods
Arranges the generated controls in the specified column and row layout based on the current flow direction and column count.
protected virtual void ArrangeControls()
Arranges the labels in each column by calculating the maximum width needed and applying consistent sizing for proper alignment.
protected virtual void ArrangeLabels()
Binds the data entry to the current data source by clearing existing controls and generating new editors based on the data source properties.
public void Bind()
Clears all generated controls and resets the internal collections and validation information.
public void Clear()
Creates a data binding between the specified control property and the data source member.
protected virtual Binding CreateBinding(Control control, string propertyName, string dataMember)
The control to bind.
propertyNamestringThe name of the control property to bind.
dataMemberstringThe name of the data source member to bind to.
Returns:A Binding object, or null if binding creation was cancelled.
Creates a RadCheckBox editor for boolean properties.
protected virtual Control CreateBoolean(PropertyDescriptor property)
The property descriptor for the boolean property.
Returns:A configured RadCheckBox control or null if creation was cancelled.
Creates and initializes the child elements of the RadDataEntryElement with appropriate CSS classes.
protected override void CreateChildElements()
Overrides:
Creates a RadColorBox editor for color properties.
protected virtual Control CreateColor(PropertyDescriptor property)
The property descriptor for the color property.
Returns:A configured RadColorBox control or null if creation was cancelled.
Creates a RadDateTimePicker editor for DateTime properties.
protected virtual Control CreateDateTime(PropertyDescriptor property)
The property descriptor for the DateTime property.
Returns:A configured RadDateTimePicker control or null if creation was cancelled.
Creates appropriate editor controls for each browsable property in the data source.
protected virtual void CreateEditors()
Creates a RadDropDownList editor for enum properties.
protected virtual Control CreateEnum(PropertyDescriptor property)
The property descriptor for the enum property.
Returns:A configured RadDropDownList control or null if creation was cancelled.
Creates a PictureBox editor for image properties.
protected virtual Control CreateImage(PropertyDescriptor property)
The property descriptor for the image property.
Returns:A configured PictureBox control or null if creation was cancelled.
Creates a RadSpinEditor for numeric properties.
protected virtual Control CreateSpinEditor(PropertyDescriptor property)
The property descriptor for the numeric property.
Returns:A configured RadSpinEditor control or null if creation was cancelled.
Creates a RadTextBox editor for text properties.
protected virtual Control CreateTextBox(PropertyDescriptor property)
The property descriptor for the text property.
Returns:A configured RadTextBox control or null if creation was cancelled.
Analyzes the data source properties and identifies which properties should have editor controls created for them.
protected virtual void FindRequiredProperties()
Generates and arranges the editor controls at design time using the designer host services.
protected virtual void GenerateControlsDesignTime(int currentColumn, KeyValuePair<string, Control> pair, Size propertyItemControlSize, Point propertyItemControlLocation)
The current column index for positioning.
pairKeyValuePair<string, Control>The key-value pair containing the property name and its associated editor control.
propertyItemControlSizeSizeThe size for the property item control.
propertyItemControlLocationPointThe location for the property item control.
Generates and arranges the editor controls at runtime with proper theming and layout.
protected virtual bool GenerateControlsRunTime(int currentColumn, KeyValuePair<string, Control> pair, Size propertyItemControlSize, Point propertyItemControlLocation)
The current column index for positioning.
pairKeyValuePair<string, Control>The key-value pair containing the property name and its associated editor control.
propertyItemControlSizeSizeThe size for the property item control.
propertyItemControlLocationPointThe location for the property item control.
Returns:true if the control was successfully generated; otherwise, false.
Initializes the data entry by setting up designer services if available in design-time mode.
protected virtual void InitializeDataEntry()
Initializes the default field values for the RadDataEntryElement.
protected override void InitializeFields()
Overrides:
Raises the BindingCreated event.
protected virtual void OnBindingCreated(object sender, BindingCreatedEventArgs e)
The sender of the event.
eBindingCreatedEventArgsThe BindingCreatedEventArgs instance containing the event data.
Raises the BindingCreating event.
protected virtual void OnBindingCreating(object sender, BindingCreatingEventArgs e)
The sender of the event.
eBindingCreatingEventArgsThe BindingCreatingEventArgs instance containing the event data.
Raises the EditorInitialized event.
protected virtual void OnEditorInitialized(object sender, EditorInitializedEventArgs e)
The sender of the event.
eEditorInitializedEventArgsThe EditorInitializedEventArgs instance containing the event data.
Raises the EditorInitializing event.
protected virtual void OnEditorInitializing(object sender, EditorInitializingEventArgs e)
The sender of the event.
eEditorInitializingEventArgsThe EditorInitializingEventArgs instance containing the event data.
Raises the ItemInitialized event.
protected virtual void OnItemInitialized(object sender, ItemInitializedEventArgs e)
The sender of the event.
eItemInitializedEventArgsThe ItemInitializedEventArgs instance containing the event data.
Raises the ItemInitializing event.
protected virtual void OnItemInitializing(object sender, ItemInitializingEventArgs e)
The sender of the event.
eItemInitializingEventArgsThe ItemInitializingEventArgs instance containing the event data.
Raises the ItemValidated event.
protected virtual void OnItemValidated(object sender, ItemValidatedEventArgs e)
The sender of the event.
eItemValidatedEventArgsThe ItemValidatedEventArgs instance containing the event data.
Raises the ItemValidating event.
protected virtual void OnItemValidating(object sender, ItemValidatingEventArgs e)
The sender of the event.
eItemValidatingEventArgsThe ItemValidatingEventArgs instance containing the event data.
Called when the element is loaded and performs final setup including clearing control borders.
protected override void OnLoaded()
Overrides:
Configures the internal structure and properties of the container panel, label, validation label, and editor control.
protected virtual void SetupInnerControls(KeyValuePair<string, Control> pair, Size propertyItemControlSize, Point propertyItemControlLocation, RadPanel propertyItemContainer, RadLabel labelControl, RadLabel validationControl, Control editorControl)
The key-value pair containing the property name and its associated editor control.
propertyItemControlSizeSizeThe size for the property item control.
propertyItemControlLocationPointThe location for the property item control.
propertyItemContainerRadPanelThe container panel that will hold all the controls.
labelControlRadLabelThe label control displaying the property name.
validationControlRadLabelThe label control for displaying validation messages.
editorControlControlThe editor control for the property value.
Subscribes a control to validation events and sets up error provider for the specified property.
public void SubscribeControl(Control control, PropertyDescriptor property, RadLabel label, RadLabel validationLabel)
The editor control to subscribe.
propertyPropertyDescriptorThe property descriptor associated with the control.
labelRadLabelThe label control displaying the property name.
validationLabelRadLabelThe label control for displaying validation messages.
Events
Occurs when a data binding has been successfully created for an editor control.
public event BindingCreatedEventHandler BindingCreated
Occurs when a data binding is being created for an editor control. This event can be cancelled to prevent binding creation.
public event BindingCreatingEventHandler BindingCreating
Occurs when an editor control has been successfully initialized.
public event EditorInitializedEventHandler EditorInitialized
Occurs when an editor control is being initialized. This event can be cancelled to prevent editor creation.
public event EditorInitializingEventHandler EditorInitializing
Occurs when a property item container has been successfully initialized.
public event ItemInitializedEventHandler ItemInitialized
Occurs when a property item container is being initialized. This event can be cancelled to prevent item creation.
public event ItemInitializingEventHandler ItemInitializing
Occurs when an editor item has been validated and validation has completed.
public event ItemValidatedEventHandler ItemValidated
Occurs when an editor item is being validated and validation rules are being checked.
public event ItemValidatingEventHandler ItemValidating