Table of Contents

Class CustomTextBox

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Base class for text editors.

[ControlCategory("Hidden")]
public abstract class CustomTextBox : Control, IBaseObjectWithId, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IWin32Window, ICustomTextBox, IDisposable, IReadOnlyStrings, IValidatorReporter, IObjectToStringOptions, INotifyDataErrorInfo
Inheritance
CustomTextBox
Implements
Derived

Constructors

CustomTextBox()

Initializes a new instance of the CustomTextBox class.

CustomTextBox(Control)

Initializes a new instance of the CustomTextBox class.

Properties

AllowEmptyText

Gets or sets a value indicating whether empty string is allowed in Text.

AutoShowError

Gets or sets whether error reporter is automatically shown/hidden when error state is changed.

Context

Gets or sets ITypeDescriptorContext value which is used when text to/from value is converted using TypeConverter.

Converter

Gets or sets IObjectToString provider which is used in value to string convertion.

Culture

Gets or sets CultureInfo value which is used when text to/from value is converted using TypeConverter.

DataType

Gets or sets Type of the Text property.

DefaultErrorBackgroundColor

Gets or sets default Color that can be used as a background color for the TextBox in cases when application needs to report user an error in Text property.

DefaultErrorForegroundColor

Gets or sets default Color that can be used as a foreground color for the TextBox in cases when application needs to report user an error in Text property.

DefaultErrorUseBackgroundColor

Gets or sets whether to use DefaultErrorBackgroundColor when application needs to report user an error.

DefaultErrorUseForegroundColor

Gets or sets whether to use DefaultErrorForegroundColor when application needs to report user an error.

DefaultFormat

Gets or sets default format used in value to string convertion.

DefaultResetErrorBackgroundMethod

Gets or sets default value for the ResetErrorBackgroundMethod property.

DefaultResetErrorForegroundMethod

Gets or sets default value for the ResetErrorForegroundMethod property.

DefaultText

Gets or sets default value for the Text property.

DefaultValidatorErrorText

Gets or sets a text string that can be used as a default validator error message.

EmptyTextValue

Gets or sets data value in cases when Text property is empty.

FormatProvider

Gets or sets an object that supplies culture-specific formatting information.

HasErrors

Gets a value that indicates whether this control or its child controls have validation errors.

InputType

Gets or sets input type. Default is Null.

InputTypeArgs

Gets or sets init arguments which are used when InputType property is assigned.

IsFloat

Gets whether DataType specifies a float number (single, double, decimal).

IsHexNumber

Gets whether NumberStyles has HexNumber flag.

IsMinValueNegativeOrNull

Gets whether MinValue is specified and negative.

IsNullOrEmpty

Gets whether Text is null or empty.

IsNullOrWhiteSpace

Gets whether Text is null or white space.

IsNumber

Gets whether DataType is a number type.

IsRequired

Gets or sets a value indicating whether Text is required to be not empty. This is an opposite of AllowEmptyText property.

IsSignedInt

Gets whether DataType specifies a signed integer number (int, long, sbyte, short). Additionally MinValue is also checked whether it allows negative numbers.

IsSignedNumber

Gets whether DataType specifies a signed number. Additionally MinValue is also checked whether it allows negative numbers.

IsUnsignedInt

Gets whether DataType specifies an unsigned integer number (uint, ulong, byte, ushort).

MaxLength

Gets or sets the maximum number of characters the user can enter into the control.

MaxValue

Gets or sets the maximum value that can be entered in the control.

MinLength

Gets or sets the minimum number of characters the user must enter into the control.

MinValue

Gets or sets the minimum value that can be entered in the control.

NumberStyles

Gets or sets a bitwise combination of NumberStyles values that indicates the permitted format of the text.

Options

Gets or sets flags which customize behavior and visual style of the control.

ResetErrorBackgroundMethod

Gets or sets method which is used to clear error state if error backround color is used for reporting it.

ResetErrorForegroundMethod

Gets or sets method which is used to clear error state if error foreground color is used for reporting it.

Search

Gets or sets string search provider.

TextAsNumber

Gets or sets Text property value as object of a number type.

TextAsValue

Gets or sets Text as object using DataType, TypeConverter and other properties which define text to/from value conversion rules.

TextAsValueError

Gets last error occured inside TextAsValue property getter or setter.

TrimTextRules

Gets or sets text trimming rules used in TextAsValue setter and some other places.

TypeConverter

Gets or sets TypeConverter used for the text to/from value conversion. You also need to specify UseTypeConverter in Options.

ValidatorErrorText

Gets or sets a text string that can be used as validator error message.

ValidatorReporter

Gets or sets validator reporter object or control.

Methods

DataTypeIsNumber()

Returns true if DataType is a number type.

GetDataTypeCode()

Returns TypeCode for the DataType property or String.

GetErrors()

Gets the validation errors.

GetErrors(string?)

Gets the validation errors for this control and its child controls.

GetKnownErrorText(ValueValidatorKnownError)

Gets known error text.

GetLineText(long)

Returns the contents of a given line in the text control, not including any trailing newline character(s).

GetMinMaxRangeStr(string?)

Returns minimal and maximal possible values for the DataType as a range string and formats it using format.

GetNumberOfLines()

Returns the number of lines in the text control buffer.

GetRealMaxValue()

Gets "real" maxmimal value taking into account DataType and MinValue.

GetRealMinValue()

Gets "real" minimal value taking into account DataType and MinValue.

HasErrorEmptyText()

Gets 'Empty Text' error status if empty text is not allowed.

HasErrorMaxLength()

Gets 'Max Length' error status if MaxLength is specified.

HasErrorMinLength()

Gets 'Min Length' error status if MinLength is specified.

InitErrorPicture(PictureBox)

Initializes PictureBox with error image and other options.

IsValidInputChar(char)

Gets whether the specified character is valid for the input. This function allows to ignore unwanted characters in the input.

ObjectToString(object?, TextBoxOptions?)

Converts the specified object to string using conversion rules specified in the control.

ReportErrorBadNumber(Action<string>?)

Reports an error if DataType is a number type and TextAsNumber is null.

ReportErrorEmptyText(Action<string>?)

Reports an error if Text property is empty and it is not allowed (AllowEmptyText is false).

ReportErrorMinMaxLength(Action<string>?)

Reports an error if length of the Text property value is less than MinLength or greater than MaxLength.

ReportErrorMinMaxValue(object?, Action<string>?)

Reports an error if value is less than MinValue or greater than MaxValue.

ReportValidatorError(bool, string?, Action<string>?)

Reports text validation error.

ResetInputSettings()

Resets fields and properties before editing new value with the different data type. You can call this method in order to reset members related to data type, formatting and value conversion.

RunDefaultValidation(Action<string>?)

Runs default validation of the Text property.

SetErrorText(ValueValidatorKnownError)

Sets ValidatorErrorText property to knownError.

SetErrorTextFromDataType()

Sets ValidatorErrorText with default error text for the data type specified in DataType.

SetTextAsByte(byte)

Converts value to string and assigns Text property with the converted value.

SetTextAsDateTime(DateTime)

Converts value to string and assigns Text property with the converted value.

SetTextAsDecimal(decimal)

Converts value to string and assigns Text property with the converted value.

SetTextAsDouble(double)

Converts value to string and assigns Text property with the converted value.

SetTextAsInt16(short)

Converts value to string and assigns Text property with the converted value.

SetTextAsInt32(int)

Converts value to string and assigns Text property with the converted value.

SetTextAsInt64(long)

Converts value to string and assigns Text property with the converted value.

SetTextAsObject(object?)

Converts value to string and assigns Text property with the converted value.

SetTextAsSByte(sbyte)

Converts value to string and assigns Text property with the converted value.

SetTextAsSingle(float)

Converts value to string and assigns Text property with the converted value.

SetTextAsUInt16(ushort)

Converts value to string and assigns Text property with the converted value.

SetTextAsUInt32(uint)

Converts value to string and assigns Text property with the converted value.

SetTextAsUInt64(ulong)

Converts value to string and assigns Text property with the converted value.

SetValidator(Type?, bool)

Sets DataType to the specified type and and CharValidator to the appropriate validator provider.

SetValueAndValidator(object?, bool)

Sets text as value (using SetTextAsObject(object?)) and assigns appropriate char and value validators.

TextAsNumberOrDefault<T>(T)

Returns TextAsNumber or defValue if it is null.

UseCharValidator<T>()

Sets DataType property to T and CharValidator to the appropriate validator provider.

Events

ErrorStatusChanged

Occurs when ReportValidatorError(bool, string?, Action<string>?) is called.

GlobalStringToValue

Occurs when string is converted to value. This is static event and is called for all the editors.

GlobalValueToString

Occurs when value is converted to string. This is static event and is called for all the editors.

StringToValue

Occurs when string is converted to value in this control.

ValueToString

Occurs when value is converted to string in this control.