Class SfNumericEntry
Represents a control that can be used to display and edit numbers.
Implements
Inherited Members
Namespace: Syncfusion.Maui.Inputs
Assembly: Syncfusion.Maui.Inputs.dll
Syntax
public class SfNumericEntry : SfView, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITextInputLayout, ITextElement, ITouchListener, IKeyboardListener, IParentThemeElement, IThemeElement
Examples
<editor:SfNumericEntry Placeholder = "Enter your age"
Value="{x:Bind Path=ViewModel.NumericEntryValue, Mode=TwoWay}" />
Constructors
SfNumericEntry()
Initializes a new instance of the SfNumericEntry class.
Declaration
public SfNumericEntry()
Fields
AllowNullProperty
Identifies AllowNull dependency property.
Declaration
public static readonly BindableProperty AllowNullProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
AutoReverseProperty
Identifies AutoReverse dependency property.
Declaration
public static readonly BindableProperty AutoReverseProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ClearButtonColorProperty
Identifies ClearButtonColor bindable property.
Declaration
public static readonly BindableProperty ClearButtonColorProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ClearButtonColor bindable property. |
ClearButtonPathProperty
Identifies the ClearButtonPath bindable property. This property can be used to Customize the clear button of NumericEntry control.
Declaration
public static readonly BindableProperty ClearButtonPathProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ClearButtonPath bindable property. |
CultureProperty
Identifies Culture dependency property.
Declaration
public static readonly BindableProperty CultureProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CursorPositionProperty
Identifies CursorPosition dependency property.
Declaration
public static readonly BindableProperty CursorPositionProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CustomFormatProperty
Identifies CustomFormat dependency property.
Declaration
public static readonly BindableProperty CustomFormatProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
DownButtonTemplateProperty
Identifies DownButtonTemplateProperty bindable property.
Declaration
public static readonly BindableProperty DownButtonTemplateProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the DownButtonTemplate bindable property. |
EntryVisibilityProperty
Identifies Syncfusion.Maui.Inputs.SfNumericEntry.EntryVisibility dependency property.
Declaration
public static readonly BindableProperty EntryVisibilityProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
FontAttributesProperty
Identifies the FontAttributes bindable property.
Declaration
public static readonly BindableProperty FontAttributesProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontAttributes bindable property. |
FontAutoScalingEnabledProperty
Identifies the FontAutoScalingEnabled bindable property.
Declaration
public static readonly BindableProperty FontAutoScalingEnabledProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontAutoScalingEnabled bindable property. |
FontFamilyProperty
Identifies the FontFamily bindable property.
Declaration
public static readonly BindableProperty FontFamilyProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontFamily bindable property. |
FontSizeProperty
Identifies the FontSize bindable property.
Declaration
public static readonly BindableProperty FontSizeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for FontSize bindable property. |
HorizontalTextAlignmentProperty
Gets or sets the value of HorizontalTextAlignment. This property can be used to give HorizontalTextAlignment to the Text in NumericEntry control.This is Bindable Property.
Declaration
public static readonly BindableProperty HorizontalTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
IsEditableProperty
Identifies IsEditable dependency property.
Declaration
public static readonly BindableProperty IsEditableProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LargeChangeProperty
Identifies LargeChange dependency property.
Declaration
public static readonly BindableProperty LargeChangeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MaximumNumberDecimalDigitsProperty
Identifies MaximumNumberDecimalDigits dependency property.
Declaration
public static readonly BindableProperty MaximumNumberDecimalDigitsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MaximumProperty
Identifies Maximum dependency property.
Declaration
public static readonly BindableProperty MaximumProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MinimumProperty
Identifies Minimum dependency property.
Declaration
public static readonly BindableProperty MinimumProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PercentDisplayModeProperty
Identifies PercentDisplayMode dependency property.
Declaration
public static readonly BindableProperty PercentDisplayModeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the PercentDisplayMode dependency property. |
PlaceholderColorProperty
Identifies PlaceholderColor bindable property.
Declaration
public static readonly BindableProperty PlaceholderColorProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the PlaceholderColor bindable property. |
PlaceholderProperty
Identifies Placeholder dependency property.
Declaration
public static readonly BindableProperty PlaceholderProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ReturnCommandParameterProperty
Identifies the ReturnCommandParameter bindable property. ReturnCommandParameter is a type of object and it specifies the parameter for the ReturnCommand.
Declaration
public static readonly BindableProperty ReturnCommandParameterProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ReturnCommandParameter bindable property. |
ReturnCommandProperty
Identifies the ReturnCommand bindable property.The return command will trigger whenever the return key is pressed. The default value is null.
Declaration
public static readonly BindableProperty ReturnCommandProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ReturnCommand bindable property. |
ReturnTypeProperty
Identifies the ReturnType bindable property. This property can be used to change the ReturnType.
Declaration
public static readonly BindableProperty ReturnTypeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ReturnType bindable property. |
SelectionLengthProperty
Identifies SelectionLength dependency property.
Declaration
public static readonly BindableProperty SelectionLengthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowBorderProperty
Identifies ShowBorder dependency property.
Declaration
public static readonly BindableProperty ShowBorderProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ShowBorder dependency property. |
ShowClearButtonProperty
Identifies ShowClearButton dependency property.
Declaration
public static readonly BindableProperty ShowClearButtonProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ShowClearButton dependency property. |
SmallChangeProperty
Identifies SmallChange dependency property.
Declaration
public static readonly BindableProperty SmallChangeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
StrokeProperty
Identifies Stroke bindable property.
Declaration
public static readonly BindableProperty StrokeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the Stroke bindable property. |
TextColorProperty
Identifies the TextColor bindable property.
Declaration
public static readonly BindableProperty TextColorProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for TextColor bindable property. |
UpButtonTemplateProperty
Identifies UpButtonTemplateProperty bindable property.
Declaration
public static readonly BindableProperty UpButtonTemplateProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the UpButtonTemplate bindable property. |
UpDownButtonColorProperty
Identifies UpDownButtonColor bindable property.
Declaration
public static readonly BindableProperty UpDownButtonColorProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the UpDownButtonColor bindable property. |
UpDownPlacementModeProperty
Identifies UpDownPlacementMode dependency property.
Declaration
public static readonly BindableProperty UpDownPlacementModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ValueChangeModeProperty
Gets or sets the value change mode, which determines how entered text is parsed to update the 'Value' property.
Declaration
public static readonly BindableProperty ValueChangeModeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty | The identifier for the ValueChangeMode bindable property. |
ValueProperty
Identifies Value dependency property.
Declaration
public static readonly BindableProperty ValueProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
VerticalTextAlignmentProperty
Gets or sets the value of VerticalTextAlignment. This property can be used to give VerticalTextAlignment to the Text in NumericEntry control.This is Bindable Property.
Declaration
public static readonly BindableProperty VerticalTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
AllowNull
Gets or sets a value indicating whether the SfNumericEntry allows null value or not.
Declaration
public bool AllowNull { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true when SfNumericEntry allows null value input, otherwise false. The default value is true. |
Remarks
Placeholder text will only appear when Value is set to NaN or null or when the input is cleared by the user.
AutoReverse
Gets or sets a value indicating whether to enable or disable the cyclic behavior when the value reaches the minimum or maximum value.
Declaration
public bool AutoReverse { get; set; }
Property Value
Type |
---|
System.Boolean |
ClearButtonColor
Gets or sets a color that describes the color of clear button.
Declaration
public Color ClearButtonColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | Specifies the value for clear button. The default value is Colors.Black. |
ClearButtonPath
Gets or sets the path to customize the appearance of the clear button in the NumericEntry control.
Declaration
public Path ClearButtonPath { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Shapes.Path | Specifies the ClearButtonPath. The default value is null |
Culture
Gets or sets the culture for SfNumericEntry.
Declaration
public CultureInfo Culture { get; set; }
Property Value
Type | Description |
---|---|
System.Globalization.CultureInfo | The default value is |
CursorPosition
Gets or sets the cursor position of the SfNumericEntry control.
Declaration
public int CursorPosition { get; set; }
Property Value
Type |
---|
System.Int32 |
CustomFormat
Gets or sets the format used to specify the formatting of Value.
Declaration
public string CustomFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String | The default value is |
Examples
To display custom text.
editor.CustomFormatter = "#.# dollars";
To display a minimum of 2 decimal digits and maximum of 4 digits, with grouping.
editor.CustomFormatter = "#,0.00##";
To remove group separator.
editor.CustomFormatter = "#,#.#";
To display currency format.
editor.CustomFormatter = "C";
To display percentage format, with a minimum of 2 decimal digits.
editor.CustomFormatter = "#.#%";
DownButtonTemplate
Gets or sets a Data template for down button.
Declaration
public DataTemplate DownButtonTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DataTemplate | Specifies the template for down button. The default value is null. |
Font
Gets or sets the font for the text of SfNumericEntry.
Declaration
public Font Font { get; }
Property Value
Type |
---|
Microsoft.Maui.Font |
FontAttributes
Gets or sets the value that indicates whether the font for the NumericEntry text is bold,italic, or neither.
Declaration
public FontAttributes FontAttributes { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.FontAttributes |
FontAutoScalingEnabled
Enables automatic font size adjustment based on device settings.
Declaration
public bool FontAutoScalingEnabled { get; set; }
Property Value
Type |
---|
System.Boolean |
FontFamily
Gets or sets the font family for the text of SfNumericEntry.
Declaration
public string FontFamily { get; set; }
Property Value
Type |
---|
System.String |
FontSize
Gets or sets the value of FontSize. This property can be used to the size of the font for SfNumericEntry.
Declaration
public double FontSize { get; set; }
Property Value
Type |
---|
System.Double |
HorizontalTextAlignment
Gets or sets a value to change the horizontal alignment of text within the NumericEntry control.
Declaration
public TextAlignment HorizontalTextAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.TextAlignment | Specifies the text alignment.The default value is Microsoft.Maui.TextAlignment.Start. |
IsEditable
Gets or sets a value indicating whether the SfNumericEntry allows editing the value or not.
Declaration
public bool IsEditable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true when SfNumericEntry is editable, otherwise false. The default value is true. |
LargeChange
Gets or sets the value that is added to or subtracted from Value when a large change is made, such as with the PageUP and PageDown keys.
Declaration
public double LargeChange { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is |
Maximum
Gets or sets the numerical maximum for Value.
Declaration
public double Maximum { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is |
MaximumNumberDecimalDigits
Gets or sets the value of MaximumNumberDecimalDigits. It determines the maximum number of decimal digits to be allowed in numeric text box.
Declaration
public int MaximumNumberDecimalDigits { get; set; }
Property Value
Type |
---|
System.Int32 |
Minimum
Gets or sets the numerical minimum for Value.
Declaration
public double Minimum { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is |
PercentDisplayMode
Gets or sets the percent display mode that parses the entered text as percentage in specified mode.
Declaration
public PercentDisplayMode PercentDisplayMode { get; set; }
Property Value
Type | Description |
---|---|
PercentDisplayMode | The default value is Compute. |
Placeholder
Gets or sets the text that is displayed in the control until the value is changed by a user action or some other operation.
Declaration
public string Placeholder { get; set; }
Property Value
Type | Description |
---|---|
System.String | The default value is |
Remarks
Placeholder text will only appear when Value is set to NaN or when the input is cleared by the user. Value can be cleared by selecting all the text and delete, by clicking the clear button, or by setting Value to null. Value can be cleared, only when AllowNull is set to true.
PlaceholderColor
Gets or sets a color that describes the color of placeholder text.
Declaration
public Color PlaceholderColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | Specifies the value for place holder color. The default value is Colors.Black. |
ReturnCommand
Gets or sets the Returncommand to run when the user presses the return key, either physically or on the on-screen keyboard.
Declaration
public ICommand ReturnCommand { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | Specifies the Returncommand. The default value is null. |
ReturnCommandParameter
Gets or sets the parameter object for the ReturnCommand that can be used to provide extra information.
Declaration
public object ReturnCommandParameter { get; set; }
Property Value
Type | Description |
---|---|
System.Object | Specifies the ReturncommandParameter. The default value in null |
ReturnType
Gets or sets the value of ReturnType. This property can be used to set the ReturnType.
Declaration
public ReturnType ReturnType { get; set; }
Property Value
Type |
---|
Microsoft.Maui.ReturnType |
SelectionLength
Gets or sets the selection length of the SfNumericEntry control.
Declaration
public int SelectionLength { get; set; }
Property Value
Type |
---|
System.Int32 |
ShowBorder
Gets or sets a value indicating whether to show or hide the border in SfNumberBox.
Declaration
public bool ShowBorder { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
ShowClearButton
Gets or sets a value indicating whether to show or hide the clear button in SfNumberBox.
Declaration
public bool ShowClearButton { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is true. |
SmallChange
Gets or sets the value that is added to or subtracted from Value when a small change is made, such as with an arrow key or scrolling.
Declaration
public double SmallChange { get; set; }
Property Value
Type | Description |
---|---|
System.Double | The default value is |
Stroke
Gets or sets a color that describes the stroke.
Declaration
public Brush Stroke { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.Brush | Specifies the color value for stroke. The default value is Colors.LightGray. |
TextColor
Gets or sets the color for the text of the SfNumericEntry control.
Declaration
public Color TextColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
UpButtonTemplate
Gets or sets a Data template for up button.
Declaration
public DataTemplate UpButtonTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Controls.DataTemplate | Specifies the template for up button. The default value is null. |
UpDownButtonColor
Gets or sets a color value for the up-down button.
Declaration
public Color UpDownButtonColor { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.Graphics.Color | Specifies the value for up-down button. The default value is Colors.Black. |
UpDownPlacementMode
Gets or sets a value that indicates the placement of buttons used to increment or decrement the Value property.
Declaration
public NumericEntryUpDownPlacementMode UpDownPlacementMode { get; set; }
Property Value
Type | Description |
---|---|
NumericEntryUpDownPlacementMode | Default value is Hidden. |
Value
Gets or sets the numeric value of a SfNumericEntry.
Declaration
public Nullable<double> Value { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | The default value is |
Remarks
When Value is changed, ValueChanged event will be triggered. When editing, Value will not be updated immediately. The entered value will be validated and updated when enter key is pressed or the control loses focus. Disable value editing by setting IsEditable to false.
ValueChangeMode
Gets or sets whether the value should be updated or not based on this property while entering the value.
Declaration
public ValueChangeMode ValueChangeMode { get; set; }
Property Value
Type |
---|
ValueChangeMode |
VerticalTextAlignment
Gets or sets a value to change the vertical alignment of text within the NumericEntry control.
Declaration
public TextAlignment VerticalTextAlignment { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.TextAlignment | Specifies the text alignment.The default value is Microsoft.Maui.TextAlignment.Center. |
Methods
ArrangeContent(Rect)
Arrange content method.
Declaration
protected override Size ArrangeContent(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Rect | bounds | The bounds. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | The size. |
Overrides
Focus()
This method sets focus to the control
Declaration
public void Focus()
GetSemanticsNodesCore(Double, Double)
Returns the semantics node list
Declaration
protected override List<SemanticsNode> GetSemanticsNodesCore(double width, double height)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | |
System.Double | height |
Returns
Type |
---|
System.Collections.Generic.List<Syncfusion.Maui.Graphics.Internals.SemanticsNode> |
Overrides
MeasureContent(Double, Double)
Measure content method.
Declaration
protected override Size MeasureContent(double widthConstraint, double heightConstraint)
Parameters
Type | Name | Description |
---|---|---|
System.Double | widthConstraint | The width constraint |
System.Double | heightConstraint | The height constraint. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | The size. |
Overrides
OnDraw(ICanvas, RectF)
Declaration
protected override void OnDraw(ICanvas canvas, RectF dirtyRect)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.ICanvas | canvas | |
Microsoft.Maui.Graphics.RectF | dirtyRect |
Overrides
OnFontChanged(Font, Font)
This method hooked whenever the font changed.
Declaration
public void OnFontChanged(Font oldValue, Font newValue)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Font | oldValue | oldValue. |
Microsoft.Maui.Font | newValue | newValue. |
OnGotFocus()
called when the Entry is focussed.
Declaration
protected void OnGotFocus()
OnHandlerChanged()
Declaration
protected override void OnHandlerChanged()
Overrides
OnLostFocus()
called when the Entry is Unfocussed.
Declaration
protected void OnLostFocus()
OnParentChanged()
Declaration
protected override void OnParentChanged()
OnPropertyChanged(String)
PropertyChanged method.
Declaration
protected override void OnPropertyChanged(string propertyName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName |
Unfocus()
This method sets unfocus to the control.
Declaration
public void Unfocus()
Events
ValueChanged
Occurs after the user triggers evaluation of new input by pressing the Enter key, clicking a spin button, or by changing focus.
Declaration
public event EventHandler<NumericEntryValueChangedEventArgs> ValueChanged
Event Type
Type |
---|
System.EventHandler<NumericEntryValueChangedEventArgs> |