This is a migrated thread and some comments may be shown as answers.

RadMaskedTextBox 7 digit phone numbers show up improperly.

1 Answer 68 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
James asked on 24 Sep 2012, 01:19 PM

I have a telerik grid with 2 phone numbers.  They are the same other than variable name:

<telerik:GridViewDataColumn Width="*"
                                                CellStyleSelector="{StaticResource InvalidHomePhoneStyleSelector}"
                                                DataFormatString="{}{0:(###) ###-####}"
                                                DataMemberBinding="{Binding HomePhone,
                                                                            Converter={StaticResource PhoneNumberNumericConverter}}"
                                                UniqueName="Phone" TextAlignment="Right">
                            <TextBlock MaxHeight="32"
                                       Text="{Binding Path=Resource.HomePhone,
                                                      Source={StaticResource Messages},
                                       TextWrapping="Wrap" />
                                <telerik:RadMaskedTextBox EmptyContent="{Binding Path=Resource.EnterPhone,
                                                                                 Source={StaticResource Messages},
                                                          Mask="(000) 000-0000"
                                                          Value="{Binding HomePhone,
                                                                          Converter={StaticResource PhoneNumberNumericConverter},
                                                                          ConverterParameter=String}" TextAlignment="Right" HorizontalContentAlignment="Right" />

The point of this web page is for the user to update invalid information for the contact.
The biggest missing info is the area code. 

The InvalidHomePhoneStyleSelector makes the numbers red and italisized if they aren't 10 numbers.
The PhoneNumberNumericConverter takes the input string and replaces all non numbers with ""

There are 2 problems:
1.  Even though I set everything to right alignment, the 7 digit numbers are showing up as (123) 456-7___ instead of (___) 123-4567
2.  Typing new characters overwrites instead of inserts.  If they set the cursor to the beginning and type in the area code, it overwrites the part of the number they already have.  Is there some property I'm missing to make editing insert instead of override?

Fixing the first problem would avoid the second. 

Thank you for your help,

James Trimmier

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 27 Sep 2012, 09:14 AM
Hello James,

It seems like the problem you are having is related to the XAML RadMaskedTextBox. To get help for it, I would advise you to open a ticket under the RadMaskedTextBox for WPF or Silverlight category or a new forum in the WPF/Silverlight forums.

All the best,
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question