Colors in Xamarin NumericUpDown (SfNumericUpDown)

19 May 20212 minutes to read

SfNumericUpDown is used to set custom background, text, and border colors through the following bindable properties:

  • TextColor - Sets the color of NumericUpDown’s value

  • BackgroundColor - Sets the background color of NumericUpDown.

  • BorderColor - Sets the border custom color of NumericUpDown

  • WatermarkColor - Sets the watermark custom color of NumericUpDown’s watermark Text.

TextColor

The following code sample demonstrates how to set the TextColor in XAML and in C#:

<numeric:SfNumericUpDown x:Name="NumericUpDown" Value="123" TextColor="Green" />
SfNumericUpDown NumericUpDown = new SfNumericUpDown();
NumericUpDown.TextColor = Color.Green;
NumericUpDown.Value = 123;
this.Content = NumericUpDown;

Display the NumericUpDown with TextColor

BackgroundColor

The following code sample demonstrates how to set the BackgroundColor in XAML and in C#:

<numeric:SfNumericUpDown x:Name="NumericUpDown" Value="123" BackgroundColor="Maroon" TextColor="White"/>
SfNumericUpDown NumericUpDown = new SfNumericUpDown();
NumericUpDown.BackgroundColor = Color.Maroon;
NumericUpDown.TextColor = Color.White;
NumericUpDown.Value = 123;
this.Content = NumericUpDown;

Display the NumericUpDown with BackgroundColor

BorderColor

The following code sample demonstrates how to set the BorderColor color in XAML and in C#:

<numeric:SfNumericUpDown x:Name="NumericUpDown" Value="123" BorderColor="Red" />
SfNumericUpDown NumericUpDown=new SfNumericUpDown();
NumericUpDown.BorderColor = Color.Red;
NumericUpDown.Value = 123;
this.Content = NumericUpDown;

Display the NumericUpDown with BorderColor

WatermarkColor

The following code sample demonstrates how to set the WatermarkColor in XAML and in C#:

<numeric:SfNumericUpDown  x:Name="NumericUpDown" AllowNull="true" WatermarkColor="Blue" />
SfNumericUpDown NumericUpDown=new SfNumericUpDown();
NumericUpDown.WatermarkColor = Color.Blue;
NumericUpDown.AllowNull=true;
this.Content = NumericUpDown;

Display the NumericUpDown with WatermarkColor

See also

How to customize the color appearance of SfNumericUpDown