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

RadMaskedTextBox 7 digit phone numbers show up improperly.

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

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}}"
                                                ShowDistinctFilters="False"
                                                UniqueName="Phone" TextAlignment="Right">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock MaxHeight="32"
                                       Text="{Binding Path=Resource.HomePhone,
                                                      Source={StaticResource Messages},
                                                      Mode=OneTime}"
                                       TextTrimming="WordEllipsis"
                                       TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <telerik:RadMaskedTextBox EmptyContent="{Binding Path=Resource.EnterPhone,
                                                                                 Source={StaticResource Messages},
                                                                                 Mode=OneTime}"
                                                          FontStyle="Normal"
                                                          IsSpinEnabled="False"
                                                          Mask="(000) 000-0000"
                                                          MaskType="Standard"
                                                          Value="{Binding HomePhone,
                                                                          Mode=TwoWay,
                                                                          Converter={StaticResource PhoneNumberNumericConverter},
                                                                          ConverterParameter=String}" TextAlignment="Right" HorizontalContentAlignment="Right" />
                            </DataTemplate>
                        </telerik:GridViewDataColumn.CellEditTemplate>
                    </telerik:GridViewDataColumn>


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
0
Tsvetina
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,
Tsvetina
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.
Tags
Ajax
Asked by
James
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or