Appearance in WPF Currency TextBox

This section deals with the appearance of CurrencyTextBox control and contains the following topics.

Setting the Foreground

The CurrencyTextBox control Foreground can be modified based on the value of the control. The following are the foreground for CurrencyTextBox control.

Foreground for Positive Value

We can change a positive color for the value of CurrencyTextBox by setting the PositiveForeground property and it will be applied when the Value is positive. The default color of PositiveForeground is Black.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Value="10" Width="100" Height="25" PositiveForeground="Blue" />
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.Value = 10;
currencyTextBox.PositiveForeground = Brushes.Blue;

CurrencyTextBox displaying value in positive foreground

Foreground for Negative Value

We can change a negative color for the value of CurrencyTextBox by setting the NegativeForeground property and it will be applied when the ApplyNegativeForeground property is true and the Value is negative. The default color of NegativeForeground is Red.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Value="-10" Width="100" Height="25"
                          NegativeForeground="SpringGreen" ApplyNegativeForeground="True" />
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.Value = -10;
currencyTextBox.ApplyNegativeForeground = true;   
currencyTextBox.NegativeForeground = Brushes.SpringGreen;

CurrencyTextBox displaying negative value in negative foreground

Foreground for Zero Value

We can change a zero color for the value of CurrencyTextBox by setting the ZeroColor property and it will be applied when the ApplyZeroColor property is true and the Value is zero.
The default color of ZeroColor is Green.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Value="0" Width="100" Height="25"
                          ApplyZeroColor="True" ZeroColor="DarkGoldenrod"/>
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.Value = 0;
currencyTextBox.ApplyZeroColor = true;
currencyTextBox.ZeroColor = Brushes.DarkGoldenrod;

CurrencyTextBox displaying zero value with zero foreground

Setting the Background

CurrencyTextBox allows different brushes to fill the control. The Background property can be used to modify the control background color. The default color of Background is White.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Width="100"
                          Height="25" Value ="80" Background="Cyan"/>
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.Background = Brushes.Cyan;

CurrencyTextBox with cyan background

Setting the Corner Radius

Corner Radius indicates the degree to which the corners of the border can be rounded. To create curved borders for the CurrencyTextBox, use CornerRadius property. The default value of CornerRadius property is 1.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Width="100" Height="25" CornerRadius="5"/>
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.CornerRadius = new CornerRadius(5);

CurrencyTextBox with corner radius

Apply Background for Selection

CurrencyTextBox allows different brushes to highlight the selected text by setting the SelectionBrush and SelectionOpacity properties. The SelectionOpacity property specifies the opacity of the SelectionBrush.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Width="100" Height="25" SelectionBrush="Red" SelectionOpacity="0.5"/>
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.SelectionBrush = Brushes.Red;
currencyTextBox.SelectionOpacity = 0.3;

CurrencyTextBox with red selection background

Align Value

CurrencyTextBox allows to display the value from right or center or left side by setting the TextAlignment property to Right or Left or Center. The Default value of TextAlignment is Left.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Width="100" Height="25" TextAlignment="Center"/>
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.TextAlignment = TextAlignment.Center;

Center aligned CurrencyTextBox Value

Setting ToolTip

CurrencyTextBox provides support for ToolTip to display certain information when the mouse hovers on the CurrencyTextBox. You can customize the tooltip information by setting the ToolTip property.

<syncfusion:CurrencyTextBox x:Name="currencyTextBox" Width="100" Height="25" ToolTip="Enter Currency Value"/>
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
currencyTextBox.Width = 100;
currencyTextBox.Height = 25;
currencyTextBox.ToolTip = "Enter Currency Value";

CurrencyTextBox with tool tip

Theme

The appearance of the CurrencyTextBox control can be customized by using the SfSkinManager.SetVisualStyle method. The following are the various built-in visual styles for CurrencyTextBox control.

  • Blend
  • Default
  • Lime
  • MaterialDark
  • MaterialDarkBlue
  • MaterialLight
  • MaterialLightBlue
  • Metro
  • Office2010Black
  • Office2010Blue
  • Office2010Silver
  • Office2013DarkGray
  • Office2013LightGray
  • Office2013White
  • Office2016Colorful
  • Office2016DarkGray
  • Office2016White
  • Office2019Black
  • Office2019Colorful
  • Office365
  • Saffron
  • SystemTheme
  • VisualStudio2013
  • VisualStudio2015
<Window
    xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
    xmlns:syncfusionskin ="clr-namespace:Syncfusion.SfSkinManager;assembly=Syncfusion.SfSkinManager.WPF">
    <Grid>
        <syncfusion:CurrencyTextBox syncfusionskin:SfSkinManager.VisualStyle="Blend" 
                                    Name="currencyTextBox" />
    </Grid>
</Window>

For example, the `Blend` style applied to the `CurrencyTextBox` as shown in the following example code:
CurrencyTextBox currencyTextBox = new CurrencyTextBox();
SfSkinManager.SetVisualStyle(currencyTextBox, VisualStyles.Blend);

CurrencyTextBox Blend visual style