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, IVisualTreeElement, 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 | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
AutoReverseProperty
Identifies AutoReverse dependency property.
Declaration
public static readonly BindableProperty AutoReverseProperty
Field Value
Type | Description |
---|---|
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. |
CultureProperty
Identifies Culture dependency property.
Declaration
public static readonly BindableProperty CultureProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
CursorPositionProperty
Identifies CursorPosition dependency property.
Declaration
public static readonly BindableProperty CursorPositionProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
CustomFormatProperty
Identifies CustomFormat dependency property.
Declaration
public static readonly BindableProperty CustomFormatProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
EntryVisibilityProperty
Identifies Syncfusion.Maui.Inputs.SfNumericEntry.EntryVisibility dependency property.
Declaration
public static readonly BindableProperty EntryVisibilityProperty
Field Value
Type | Description |
---|---|
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. |
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. |
IsEditableProperty
Identifies IsEditable dependency property.
Declaration
public static readonly BindableProperty IsEditableProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
LargeChangeProperty
Identifies LargeChange dependency property.
Declaration
public static readonly BindableProperty LargeChangeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
MaximumProperty
Identifies Maximum dependency property.
Declaration
public static readonly BindableProperty MaximumProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
MinimumProperty
Identifies Minimum dependency property.
Declaration
public static readonly BindableProperty MinimumProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
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 | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
SelectionLengthProperty
Identifies SelectionLength dependency property.
Declaration
public static readonly BindableProperty SelectionLengthProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
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 | Description |
---|---|
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. |
UpDownPlacementModeProperty
Identifies UpDownPlacementMode dependency property.
Declaration
public static readonly BindableProperty UpDownPlacementModeProperty
Field Value
Type | Description |
---|---|
Microsoft.Maui.Controls.BindableProperty |
ValueProperty
Identifies Value dependency property.
Declaration
public static readonly BindableProperty ValueProperty
Field Value
Type | Description |
---|---|
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 | Description |
---|---|
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. |
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 | Description |
---|---|
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 = "#.#%";
Font
Gets or sets the font for the text of SfNumericEntry.
Declaration
public Font Font { get; }
Property Value
Type | Description |
---|---|
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 | Description |
---|---|
Microsoft.Maui.Controls.FontAttributes |
FontFamily
Gets or sets the font family for the text of SfNumericEntry.
Declaration
public string FontFamily { get; set; }
Property Value
Type | Description |
---|---|
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 | Description |
---|---|
System.Double |
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 |
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 |
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. |
SelectionLength
Gets or sets the selection length of the SfNumericEntry control.
Declaration
public int SelectionLength { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
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 | Description |
---|---|
Microsoft.Maui.Graphics.Color |
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.
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()
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 | Description |
---|---|
System.EventHandler<NumericEntryValueChangedEventArgs> |