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