Masked TextBox Used with different mask on adjacent Rows in database.

Jul 4, 2012 at 7:28 AM

The following code is used within a User Control on a WPF form:

<toolkit:MaskedTextBox x:Name="telephone" Grid.Column="1" Grid.Row="1" Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplateResource}"

Padding="3" IncludeLiterals="True" IncludePrompt="True" IsEnabled="False"

Mask="{Binding Path=Mask,FallbackValue=CCCCCCCCCCCCCCCCCCCC}"

SelectAllOnGotFocus="True"

Value="{Binding Path=Telephone,UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True,Mode=TwoWay}" />

 

If the Mask contains "+44 (0) 0000 000000" for record 1 with data entered into the Telephone Field this works fine. However if the next record contains a different Mask e.g "+4\\9 0009 00009 099" with correctly entered field information on occasions the Mask and field Data are not always in sync which causes the incorrect information to appear in the Telephone field.

Is there a way of ensure that Mask and field Data work in sync?

Wayne Russell - Karus Systems Limited - www.karus.com