RadColorBoxElement
Represents the core element of the RadColorBox control that provides color selection functionality with text input and color dialog capabilities. This element combines a text input field, color display box, and color picker button to create a comprehensive color editing interface.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadColorBoxElement : RadTextBoxElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemRadEditorElementRadTextBoxElementRadColorBoxElement...
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadColorBoxElement class.
public RadColorBoxElement()
Properties
Gets the ColorEditorColorBox that displays the currently selected color in the editor.
public ColorEditorColorBox ColorBox { get; }
Gets or sets the RadColorDialog that is displayed when the color picker button is clicked.
public RadColorDialog ColorDialog { get; set; }
Gets the ColorPickerButtonElement that opens the RadColorDialog when clicked.
public ColorPickerButtonElement ColorPickerButton { get; }
Gets or sets a value indicating whether the user is allowed to type directly in the text field. When true, only color selection through the dialog is permitted.
public bool ReadOnly { get; set; }
Gets or sets the color value of the editor. When setting a value, the change can be canceled through the ValueChanging event.
public virtual Color Value { get; set; }
Methods
Creates the child elements that compose the color box including the stack layout, color display box, color dialog, and color picker button.
protected override void CreateChildElements()
Overrides:
Creates the color display box element that shows the currently selected color.
protected virtual ColorEditorColorBox CreateColorBoxElement()
A new instance of ColorEditorColorBox.
Creates the color dialog that will be displayed when the color picker button is clicked.
Creates the color picker button element that opens the color dialog when clicked.
protected virtual ColorPickerButtonElement CreateColorPickerButtonElement()
A new instance of ColorPickerButtonElement.
Releases the managed resources used by the RadColorBoxElement and optionally releases the unmanaged resources.
protected override void DisposeManagedResources()
Overrides:
Gets the current color value by parsing the text input. If parsing fails, returns the last successfully parsed value.
Initializes the default field values and behavior settings for the color box element.
protected override void InitializeFields()
Overrides:
Raises the DialogClosed event after the color dialog is closed.
protected virtual void OnDialogClosed(DialogClosedEventArgs e)
The DialogClosedEventArgs instance containing the event data.
Handles key down events with special processing for Enter and Escape keys to commit or revert color changes.
protected override void OnKeyDown(KeyEventArgs e)
The KeyEventArgs instance containing the event data.
Overrides:
Handles property changed events and forwards them to the base class. Additionally handles right-to-left property changes by updating the shape orientations.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
The RadPropertyChangedEventArgs instance containing the event data.
Overrides:
Handles property changing events and forwards them to the base class only when not in the middle of a value changing operation and the property is not the Text property.
protected override void OnPropertyChanging(RadPropertyChangingEventArgs args)
The RadPropertyChangingEventArgs instance containing the event data.
Overrides:
Handles the text changing event and cancels it if the control is in read-only mode.
protected override void OnTextChanging(TextChangingEventArgs e)
The TextChangingEventArgs instance containing the event data.
Overrides:
Raises the ValueChanged event after the editor color value has been successfully changed.
Raises the ValueChanging event before the editor color value is changed, allowing the change to be canceled.
protected virtual void OnValueChanging(ValueChangingEventArgs e)
The ValueChangingEventArgs instance containing the event data.
Sets the color value of the editor with validation and change notification. If the control is read-only, the operation is ignored.
public virtual void SetColorValue(Color newValue)
The new color value to set.
Unwires the event handlers for the color picker button and other child elements.
protected virtual void UnwireEvents()
Validates the current text input by attempting to convert it to a valid color value.
public virtual bool Validate()
true if the text represents a valid color; otherwise, false.
Wires the necessary event handlers for the color picker button and other child elements.
protected virtual void WireEvents()
Events
Occurs when the color dialog window is closed, regardless of whether a color was selected.
public event DialogClosedEventHandler DialogClosed
Occurs after the editor has successfully changed the color value during the editing process.
public event EventHandler ValueChanged
Occurs when the color value is being changed and allows the change to be canceled.
public event ValueChangingEventHandler ValueChanging