Class ObjectTextBox
- Namespace
- CarinaStudio.Controls
- Assembly
- CarinaStudio.AppBase.Avalonia.dll
Avalonia.Controls.TextBox which treat input text as object with specific type.
public abstract class ObjectTextBox : TextBox, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, IInputElement, IDataTemplateHost, INamed, ISetterValue
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlTextBoxObjectTextBox
- 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.OnLostFocus(RoutedEventArgs)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
ObjectTextBox()
Initialize new ObjectTextBox instance.
protected ObjectTextBox()
Fields
AcceptsWhiteSpacesProperty
Property of AcceptsWhiteSpaces.
public static readonly StyledProperty<bool> AcceptsWhiteSpacesProperty
Field Value
- StyledProperty<bool>
IsTextValidProperty
Property of IsTextValid.
public static readonly DirectProperty<ObjectTextBox, bool> IsTextValidProperty
Field Value
- DirectProperty<ObjectTextBox, bool>
ObjectProperty
Property of Object.
public static readonly StyledProperty<object?> ObjectProperty
Field Value
- StyledProperty<object>
ValidationDelayProperty
Property of ValidationDelay.
public static readonly StyledProperty<int> ValidationDelayProperty
Field Value
- StyledProperty<int>
Properties
AcceptsWhiteSpaces
Get or set whether white space characters can be accepted or not.
public bool AcceptsWhiteSpaces { get; set; }
Property Value
IsTextValid
Get whether input Avalonia.Controls.TextBox.Text represent a valid object or not.
public bool IsTextValid { get; }
Property Value
IsValidationScheduled
Check whether text validation is scheduled or not.
protected bool IsValidationScheduled { get; }
Property Value
Object
Get or set object.
public object? Object { get; set; }
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
Methods
CheckObjectEquality(object?, object?)
Check equality of objects.
protected virtual bool CheckObjectEquality(object? x, object? y)
Parameters
Returns
- bool
True if two objects are equivalent.
ConvertToText(object)
Convert object to text.
protected virtual string? ConvertToText(object obj)
Parameters
objobjectObject.
Returns
- string
Converted text.
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.
TryConvertToObject(string, out object?)
Try converting text to object.
protected abstract bool TryConvertToObject(string text, out object? obj)
Parameters
Returns
- bool
True if conversion succeeded.
Validate()
Validate input Avalonia.Controls.TextBox.Text and generate corresponding object.
public bool Validate()
Returns
- bool
True if input Avalonia.Controls.TextBox.Text generates a valid object.