xceedsoftware / wpftoolkit

All the controls missing in WPF. Over 1 million downloads.
Other
3.87k stars 872 forks source link

MaskedTextBox.Mask: Optional characters not allowed #1777

Open JuliaVasileva opened 1 month ago

JuliaVasileva commented 1 month ago

Hi, I've been trying to create Mask for MaskedTextBox and faced a problem with optional characters.

The control seems to treat optional digits as mandatory.

Specifically:

Mask="N #90°" - where the 2 digits before the degree symbol are optional

However, values such as N 8° or N 12° are not valid

To make it valid, I need to input values with additional spaces like 'N 3°'

image

Hot to allow users to input values of different lengths without requiring additional spaces?

zhongruijia commented 1 month ago

这里是郭瑞的邮箱,已收到您的来件,我会尽快拜阅并给予您回复

XceedBoucherS commented 1 month ago

Hi,

How about using a prompt char of Empty: <xctk:MaskedTextBox Mask="N #90°" PromptChar="" HorizontalAlignment="Center" VerticalAlignment="Center"/>