Appearance in WPF MaskedTextBox (SfMaskedEdit)

18 Nov 20183 minutes to read

This section explains the UI customization and theming options available in the WPF MaskedTextBox control.

Setting the background

You can change the default background and selection colors of SfMaskedEdit by using the Background and SelectionBrush properties. The default value of the Background property is White, and the default value of the SelectionBrush property is Royal Blue.

<syncfusion:SfMaskedEdit Background="Yellow"
                         SelectionBrush="Green"
                         Name="sfMaskedEdit"/>
SfMaskedEdit sfMaskedEdit = new SfMaskedEdit();
sfMaskedEdit.Background = Brushes.Yellow;
sfMaskedEdit.SelectionBrush = Brushes.Green;

Changing Background Color of WPF MaskedTextBox

View Sample in GitHub

Setting the foreground

You can change the foreground color by using the Foreground property and the caret color by using the CaretBrush property. The default value of the Foreground property is Black, and the default value of the CaretBrush property is null.

<syncfusion:SfMaskedEdit Foreground="Blue" 
                         CaretBrush="Red"
                         Name="sfMaskedEdit"/>
SfMaskedEdit sfMaskedEdit = new SfMaskedEdit();
sfMaskedEdit.Foreground = Brushes.Blue;
sfMaskedEdit.CaretBrush = Brushes.Red;

Changing Foreground Color of WPF MaskedTextBox

View Sample in GitHub

Setting the border color

You can change the default border color of SfMaskedEdit by using the BorderBrush property. The default value of the BorderBrush property is Lavender.

<syncfusion:SfMaskedEdit BorderBrush="Blue"
                         Name="sfMaskedEdit"/>
SfMaskedEdit sfMaskedEdit = new SfMaskedEdit();
sfMaskedEdit.BorderBrush = Brushes.Blue;

Changing Border Color of WPF MaskedTextBox

View Sample in GitHub

Change flow direction

You can change the flow direction of the SfMaskedEdit layout from right to left by setting the FlowDirection property to RightToLeft. The default value of the FlowDirection property is LeftToRight.

<syncfusion:SfMaskedEdit FlowDirection="RightToLeft"
                         Name="sfMaskedEdit"/>
SfMaskedEdit sfMaskedEdit = new SfMaskedEdit();
sfMaskedEdit.FlowDirection = FlowDirection.RightToLeft;

Changing Flow Direction of WPF MaskedTextBox

View Sample in GitHub

Theme

The WPF MaskedTextBox supports various built-in themes. Refer to the following links to apply them:

Applying Theme to WPF MaskedTextBox