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