Styling the Currency and Numeric Text Boxes

The CurrencyTextBox control allows you to define a separate style for negative values in order to highlight them to users. This is actually a special case of a general conditional styling mechanism for numeric text boxes that you can use in your own custom templates.

Styling Negative Currency Values

To customize the display of negative values, use the NegativeStyle property of the CurrencyTextBox. In the default template, this style is applied to a TextBox, so the TargetType of the style should be TextBox.

Conditional Styling

You may have more specialized requirements for conditional styling than simple negative value highlighting. You can implement these using standard WPF templating and triggering techniques as follows. The account below applies to all numeric text boxes (IntegerTextBox, NumericTextBox, CurrencyTextBox).

For an example, see IntegerTextBoxStyling.xaml in the Elements sample.


You can create custom templates for the numeric text boxes (CurrencyTextBox, NumericTextBox and IntegerTextBox) using the standard WPF approach. Any custom template you create must contain the following elements:

PART_TextBox The numeric text boxes display output and receives input through this part. It must be a TextBox (or a type derived from TextBox). If this part is missing, or is not a TextBox, the numeric editor will not be able to display output or receive input.