Class ValueTextBox
- Namespace
- CarinaStudio.Controls
- Assembly
- CarinaStudio.AppBase.Avalonia.dll
Avalonia.Controls.TextBox which treat input text as given value with specific type.
public abstract class ValueTextBox : TextBox, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, IInputElement, IDataTemplateHost, INamed, ISetterValue
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlTextBoxValueTextBox
- Implements
-
IDataContextProviderILogicalIThemeVariantHostIResourceHostIResourceNodeIStyleHostISetLogicalParentISetInheritanceParentIStyleableIInputElementIDataTemplateHostINamedISetterValue
- Derived
- Inherited Members
-
TextBox.AcceptsReturnPropertyTextBox.AcceptsTabPropertyTextBox.CaretIndexPropertyTextBox.IsReadOnlyPropertyTextBox.PasswordCharPropertyTextBox.SelectionBrushPropertyTextBox.SelectionForegroundBrushPropertyTextBox.CaretBrushPropertyTextBox.SelectionStartPropertyTextBox.SelectionEndPropertyTextBox.MaxLengthPropertyTextBox.MaxLinesPropertyTextBox.TextPropertyTextBox.TextAlignmentPropertyTextBox.HorizontalContentAlignmentPropertyTextBox.VerticalContentAlignmentPropertyTextBox.TextWrappingPropertyTextBox.LineHeightPropertyTextBox.LetterSpacingPropertyTextBox.WatermarkPropertyTextBox.UseFloatingWatermarkPropertyTextBox.NewLinePropertyTextBox.InnerLeftContentPropertyTextBox.InnerRightContentPropertyTextBox.RevealPasswordPropertyTextBox.CanCutPropertyTextBox.CanCopyPropertyTextBox.CanPastePropertyTextBox.IsUndoEnabledPropertyTextBox.UndoLimitPropertyTextBox.CanUndoPropertyTextBox.CanRedoPropertyTextBox.CopyingToClipboardEventTextBox.CuttingToClipboardEventTextBox.PastingFromClipboardEventTextBox.TextChangedEventTextBox.TextChangingEventTextBox.ClearSelection()TextBox.OnApplyTemplate(TemplateAppliedEventArgs)TextBox.OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)TextBox.OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)TextBox.OnGotFocus(GotFocusEventArgs)TextBox.Cut()TextBox.Copy()TextBox.Paste()TextBox.OnKeyDown(KeyEventArgs)TextBox.OnPointerPressed(PointerPressedEventArgs)TextBox.OnPointerMoved(PointerEventArgs)TextBox.OnPointerReleased(PointerReleasedEventArgs)TextBox.OnCreateAutomationPeer()TextBox.Clear()TextBox.SelectAll()TextBox.Undo()TextBox.Redo()TextBox.MeasureOverride(Size)TextBox.CutGestureTextBox.CopyGestureTextBox.PasteGestureTextBox.AcceptsReturnTextBox.AcceptsTabTextBox.CaretIndexTextBox.IsReadOnlyTextBox.PasswordCharTextBox.SelectionBrushTextBox.SelectionForegroundBrushTextBox.CaretBrushTextBox.SelectionStartTextBox.SelectionEndTextBox.MaxLengthTextBox.MaxLinesTextBox.LetterSpacingTextBox.LineHeightTextBox.TextTextBox.SelectedTextTextBox.HorizontalContentAlignmentTextBox.VerticalContentAlignmentTextBox.TextAlignmentTextBox.WatermarkTextBox.UseFloatingWatermarkTextBox.InnerLeftContentTextBox.InnerRightContentTextBox.RevealPasswordTextBox.TextWrappingTextBox.NewLineTextBox.CanCutTextBox.CanCopyTextBox.CanPasteTextBox.IsUndoEnabledTextBox.UndoLimitTextBox.CanUndoTextBox.CanRedoTextBox.CopyingToClipboardTextBox.CuttingToClipboardTextBox.PastingFromClipboardTextBox.TextChangedTextBox.TextChangingTemplatedControl.BackgroundPropertyTemplatedControl.BorderBrushPropertyTemplatedControl.BorderThicknessPropertyTemplatedControl.CornerRadiusPropertyTemplatedControl.FontFamilyPropertyTemplatedControl.FontSizePropertyTemplatedControl.FontStylePropertyTemplatedControl.FontWeightPropertyTemplatedControl.FontStretchPropertyTemplatedControl.ForegroundPropertyTemplatedControl.PaddingPropertyTemplatedControl.TemplatePropertyTemplatedControl.IsTemplateFocusTargetPropertyTemplatedControl.TemplateAppliedEventTemplatedControl.GetIsTemplateFocusTarget(Control)TemplatedControl.ApplyTemplate()TemplatedControl.GetTemplateFocusTarget()TemplatedControl.OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnTemplateChanged(AvaloniaPropertyChangedEventArgs)TemplatedControl.BackgroundTemplatedControl.BorderBrushTemplatedControl.BorderThicknessTemplatedControl.CornerRadiusTemplatedControl.FontFamilyTemplatedControl.FontSizeTemplatedControl.FontStyleTemplatedControl.FontWeightTemplatedControl.FontStretchTemplatedControl.ForegroundTemplatedControl.PaddingTemplatedControl.TemplateTemplatedControl.TemplateAppliedControl.FocusAdornerPropertyControl.TagPropertyControl.ContextMenuPropertyControl.ContextFlyoutPropertyControl.RequestBringIntoViewEventControl.ContextRequestedEventControl.LoadedEventControl.UnloadedEventControl.SizeChangedEventControl.OnLoaded(RoutedEventArgs)Control.OnUnloaded(RoutedEventArgs)Control.OnSizeChanged(SizeChangedEventArgs)Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnKeyUp(KeyEventArgs)Control.FocusAdornerControl.DataTemplatesControl.ContextMenuControl.ContextFlyoutControl.IsLoadedControl.TagControl.ContextRequestedControl.LoadedControl.UnloadedControl.SizeChangedInputElement.FocusablePropertyInputElement.IsEnabledPropertyInputElement.IsEffectivelyEnabledPropertyInputElement.CursorPropertyInputElement.IsKeyboardFocusWithinPropertyInputElement.IsFocusedPropertyInputElement.IsHitTestVisiblePropertyInputElement.IsPointerOverPropertyInputElement.IsTabStopPropertyInputElement.GotFocusEventInputElement.LostFocusEventInputElement.KeyDownEventInputElement.KeyUpEventInputElement.TabIndexPropertyInputElement.TextInputEventInputElement.TextInputMethodClientRequestedEventInputElement.PointerEnteredEventInputElement.PointerExitedEventInputElement.PointerMovedEventInputElement.PointerPressedEventInputElement.PointerReleasedEventInputElement.PointerCaptureLostEventInputElement.PointerWheelChangedEventInputElement.TappedEventInputElement.HoldingEventInputElement.DoubleTappedEventInputElement.Focus(NavigationMethod, KeyModifiers)InputElement.OnPointerEntered(PointerEventArgs)InputElement.OnPointerExited(PointerEventArgs)InputElement.OnPointerCaptureLost(PointerCaptureLostEventArgs)InputElement.OnPointerWheelChanged(PointerWheelEventArgs)InputElement.UpdateIsEffectivelyEnabled()InputElement.FocusableInputElement.IsEnabledInputElement.CursorInputElement.IsKeyboardFocusWithinInputElement.IsFocusedInputElement.IsHitTestVisibleInputElement.IsPointerOverInputElement.IsTabStopInputElement.IsEffectivelyEnabledInputElement.TabIndexInputElement.KeyBindingsInputElement.IsEnabledCoreInputElement.GestureRecognizersInputElement.GotFocusInputElement.LostFocusInputElement.KeyDownInputElement.KeyUpInputElement.TextInputInputElement.TextInputMethodClientRequestedInputElement.PointerEnteredInputElement.PointerExitedInputElement.PointerMovedInputElement.PointerPressedInputElement.PointerReleasedInputElement.PointerCaptureLostInputElement.PointerWheelChangedInputElement.TappedInputElement.HoldingInputElement.DoubleTappedInteractive.RaiseEvent(RoutedEventArgs)Interactive.BuildEventRoute(RoutedEvent)Layoutable.DesiredSizePropertyLayoutable.WidthPropertyLayoutable.HeightPropertyLayoutable.MinWidthPropertyLayoutable.MaxWidthPropertyLayoutable.MinHeightPropertyLayoutable.MaxHeightPropertyLayoutable.MarginPropertyLayoutable.HorizontalAlignmentPropertyLayoutable.VerticalAlignmentPropertyLayoutable.UseLayoutRoundingPropertyLayoutable.UpdateLayout()Layoutable.Measure(Size)Layoutable.Arrange(Rect)Layoutable.InvalidateMeasure()Layoutable.InvalidateArrange()Layoutable.AffectsMeasure<T>(params AvaloniaProperty[])Layoutable.AffectsArrange<T>(params AvaloniaProperty[])Layoutable.MeasureCore(Size)Layoutable.ArrangeCore(Rect)Layoutable.ArrangeOverride(Size)Layoutable.OnMeasureInvalidated()Layoutable.OnVisualParentChanged(Visual, Visual)Layoutable.WidthLayoutable.HeightLayoutable.MinWidthLayoutable.MaxWidthLayoutable.MinHeightLayoutable.MaxHeightLayoutable.MarginLayoutable.HorizontalAlignmentLayoutable.VerticalAlignmentLayoutable.DesiredSizeLayoutable.IsMeasureValidLayoutable.IsArrangeValidLayoutable.UseLayoutRoundingLayoutable.EffectiveViewportChangedLayoutable.LayoutUpdatedVisual.BoundsPropertyVisual.ClipToBoundsPropertyVisual.ClipPropertyVisual.IsVisiblePropertyVisual.OpacityPropertyVisual.OpacityMaskPropertyVisual.EffectPropertyVisual.HasMirrorTransformPropertyVisual.RenderTransformPropertyVisual.RenderTransformOriginPropertyVisual.FlowDirectionPropertyVisual.VisualParentPropertyVisual.ZIndexPropertyVisual.GetFlowDirection(Visual)Visual.SetFlowDirection(Visual, FlowDirection)Visual.InvalidateVisual()Visual.Render(DrawingContext)Visual.AffectsRender<T>(params AvaloniaProperty[])Visual.InvalidateMirrorTransform()Visual.BoundsVisual.ClipToBoundsVisual.ClipVisual.IsEffectivelyVisibleVisual.IsVisibleVisual.OpacityVisual.OpacityMaskVisual.EffectVisual.HasMirrorTransformVisual.RenderTransformVisual.RenderTransformOriginVisual.FlowDirectionVisual.ZIndexVisual.VisualChildrenVisual.VisualRootVisual.BypassFlowDirectionPoliciesVisual.AttachedToVisualTreeVisual.DetachedFromVisualTreeStyledElement.DataContextPropertyStyledElement.NamePropertyStyledElement.ParentPropertyStyledElement.TemplatedParentPropertyStyledElement.ThemePropertyStyledElement.BeginInit()StyledElement.EndInit()StyledElement.ApplyStyling()StyledElement.InitializeIfNeeded()StyledElement.OnDataContextBeginUpdate()StyledElement.OnDataContextEndUpdate()StyledElement.OnInitialized()StyledElement.NameStyledElement.ClassesStyledElement.DataContextStyledElement.IsInitializedStyledElement.StylesStyledElement.StyleKeyStyledElement.ResourcesStyledElement.TemplatedParentStyledElement.ThemeStyledElement.LogicalChildrenStyledElement.PseudoClassesStyledElement.ParentStyledElement.ActualThemeVariantStyledElement.AttachedToLogicalTreeStyledElement.DetachedFromLogicalTreeStyledElement.DataContextChangedStyledElement.InitializedStyledElement.ResourcesChangedStyledElement.ActualThemeVariantChangedAnimatable.TransitionsPropertyAnimatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)Animatable.TransitionsAvaloniaObject.CheckAccess()AvaloniaObject.VerifyAccess()AvaloniaObject.ClearValue(AvaloniaProperty)AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)AvaloniaObject.ClearValue<T>(StyledProperty<T>)AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetHashCode()AvaloniaObject.GetValue(AvaloniaProperty)AvaloniaObject.GetValue<T>(StyledProperty<T>)AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)AvaloniaObject.IsAnimating(AvaloniaProperty)AvaloniaObject.IsSet(AvaloniaProperty)AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)AvaloniaObject.CoerceValue(AvaloniaProperty)AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)AvaloniaObject.InheritanceParentAvaloniaObject.this[AvaloniaProperty]AvaloniaObject.this[IndexerDescriptor]AvaloniaObject.PropertyChanged
- Extension Methods
Constructors
ValueTextBox()
Initialize new ValueTextBox instance.
protected ValueTextBox()
Fields
AcceptsWhiteSpacesProperty
Property of AcceptsWhiteSpaces.
public static readonly StyledProperty<bool> AcceptsWhiteSpacesProperty
Field Value
- StyledProperty<bool>
CoerceValueWhenLostFocusProperty
Property of CoerceValueWhenLostFocus.
public static readonly StyledProperty<bool> CoerceValueWhenLostFocusProperty
Field Value
- StyledProperty<bool>
DefaultValueProperty
Property of DefaultValue.
public static readonly StyledProperty<object?> DefaultValueProperty
Field Value
- StyledProperty<object>
IsNullValueAllowedProperty
Property of IsNullValueAllowed.
public static readonly StyledProperty<bool> IsNullValueAllowedProperty
Field Value
- StyledProperty<bool>
IsTextValidProperty
Property of IsTextValid.
public static readonly DirectProperty<ValueTextBox, bool> IsTextValidProperty
Field Value
- DirectProperty<ValueTextBox, bool>
ValidationDelayProperty
Property of ValidationDelay.
public static readonly StyledProperty<int> ValidationDelayProperty
Field Value
- StyledProperty<int>
ValueProperty
Property of Value.
public static readonly StyledProperty<object?> ValueProperty
Field Value
- StyledProperty<object>
Properties
AcceptsWhiteSpaces
Get or set whether white space characters can be accepted or not.
public bool AcceptsWhiteSpaces { get; set; }
Property Value
CoerceValueWhenLostFocus
Get or set whether value should be coerced when the control lost its focus or not.
public bool CoerceValueWhenLostFocus { get; set; }
Property Value
DefaultValue
Get of set default value for IsNullValueAllowed is False and Avalonia.Controls.TextBox.Text is empty.
public object? DefaultValue { get; set; }
Property Value
IsNullValueAllowed
Get or set whether Value can be Null or not.
public bool IsNullValueAllowed { get; set; }
Property Value
IsTextValid
Get whether input Avalonia.Controls.TextBox.Text represent a valid value or not.
public bool IsTextValid { get; }
Property Value
StyleKeyOverride
Gets the type by which the element is styled.
protected override Type StyleKeyOverride { get; }
Property Value
Remarks
Usually controls are styled by their own type, but there are instances where you want an element to be styled by its base type, e.g. creating SpecialButton that derives from Button and adds extra functionality but is still styled as a regular Button. Override this property to change the style for a control class, returning the type that you wish the elements to be styled as.
ValidationDelay
Get or set the delay of validating text after user typing in milliseconds.
public int ValidationDelay { get; set; }
Property Value
Value
Get or set value.
public object? Value { get; set; }
Property Value
Methods
CheckValueEquality(object?, object?)
Check equality of values.
protected virtual bool CheckValueEquality(object? x, object? y)
Parameters
Returns
- bool
True if two values are equivalent.
CoerceValue(object)
Coerce the set value.
protected virtual object CoerceValue(object value)
Parameters
valueobjectSet value.
Returns
- object
Coerced value.
ConvertToText(object)
Convert value to text.
protected virtual string? ConvertToText(object value)
Parameters
valueobjectValue.
Returns
- string
Converted text.
OnLostFocus(RoutedEventArgs)
Called before the Avalonia.Input.InputElement.LostFocus event occurs.
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
eRoutedEventArgsThe event args.
OnPastingFromClipboard(string?)
Called when pasting text from clipboard
protected virtual void OnPastingFromClipboard(string? text)
Parameters
textstringThe text from clipboard.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
changeAvaloniaPropertyChangedEventArgsThe property change details.
OnTextInput(TextInputEventArgs)
Called before the Avalonia.Input.InputElement.TextInput event occurs.
protected override void OnTextInput(TextInputEventArgs e)
Parameters
eTextInputEventArgsThe event args.
TryConvertToValue(string, out object?)
Try converting text to value.
protected abstract bool TryConvertToValue(string text, out object? value)
Parameters
Returns
- bool
True if conversion succeeded.
Validate()
Validate input Avalonia.Controls.TextBox.Text and generate corresponding value.
public bool Validate()
Returns
- bool
True if input Avalonia.Controls.TextBox.Text generates a valid value.