Colors in Xamarin Numeric Entry (SfNumericTextBox)

19 May 20212 minutes to read

SfNumericTextBox can be set to use a custom background,text and border colors via the following bindable properties:

  • TextColor - sets the color of the NumericTextBox’s value.

  • BackgroundColor - sets the background color of NumericTextBox’s frame.

  • BorderColor - sets the border custom color of NumericTextBox

  • WatermarkColor - sets the watermark custom color of NumericTextBox’s watermark Text.

TextColor

To set the TextColor color in XAML as well as in C#:

<syncfusion:SfNumericTextBox x:Name="numericTextBox" Value="123" TextColor="Green" />
SfNumericTextBox numericTextBox=new SfNumericTextBox();
numericTextBox.TextColor = Color.Green;
numericTextBox.Value = 123;
this.Content = numericTextBox;

Display SfNumericTextBox with TextColor

BackgroundColor

To set the BackgroundColor color in XAML as well as in C#:

<syncfusion:SfNumericTextBox x:Name="numericTextBox" Value="123" BackgroundColor="Maroon" TextColor="White"/>
SfNumericTextBox numericTextBox=new SfNumericTextBox();
numericTextBox.BackgroundColor = Color.Maroon;
numericTextBox.TextColor = Color.White;
numericTextBox.Value = 123;
this.Content = numericTextBox;

Display SfNumericTextBox with BackgroundColor

BorderColor

To set the BorderColor color in XAML as well as in C#:

<syncfusion:SfNumericTextBox x:Name="numericTextBox" Value="123" BorderColor="Red" />
SfNumericTextBox numericTextBox=new SfNumericTextBox();
numericTextBox.BorderColor = Color.Red;
numericTextBox.Value = 123;
this.Content = numericTextBox;

Display SfNumericTextBox with BorderColor

WatermarkColor

To set the WatermarkColor color in XAML as well as in C#:

<syncfusion:SfNumericTextBox  x:Name="numericTextBox" AllowNull="true" WatermarkColor="Blue" Watermark="Enter a Number"/>
SfNumericTextBox numericTextBox=new SfNumericTextBox();
numericTextBox.AllowNull=true;
numericTextBox.WatermarkColor = Color.Blue;
numericTextBox.Watermark = "Enter a Number"
this.Content = numericTextBox;

Display SfNumericTextBox with WatermarkColor

See also

How to customize the border of SfNumericTextBox

How to customize the color appearance of SfNumericTextBox