0

In my Windows Phone 8 app I use Telerik RadTextBox control.

I have a field of phone number

<Controls:RadTextBox Grid.Row="3" Grid.Column="1" Text="{Binding MobileNumber, Mode=TwoWay}"
                                     InputScope="Number" 
                                     Watermark="Phone No." />

I want to add country code to the above textbox by default - so user need not enter "+45" or so. Whatever is the device's country that country code be added to the text box.

I tried to find out how to achieve the above, but couldn't get any useful information. Is their any way to find out country-code from device, OR how do we find it. ANd how to add it to the textbox by default.

Can anyone help me achieve the goal. Thanks

Tvd
  • 4,463
  • 18
  • 79
  • 125

1 Answers1

0

You should use MaskedTextBox instead of RadTextBox. enter image description here Then you can use the phone number mask or make your own using the custom mask. In this way it is easier and you make sure that the format is properly validated.

FeliceM
  • 4,163
  • 9
  • 48
  • 75
  • Thanks FeliceM, but this doesn't get me country code on the text box. I can definetly use this approach, this helps my second part of the Q. It would be better if you can also help me know - How to get the country code ??? – Tvd Nov 19 '13 at 11:10
  • @Tvd, I am not in Phone development. I suggested you the RadMaskedtextBox because I use it in asp and windows forms. However, have a look at this link, you may get a direction from there. http://stackoverflow.com/questions/17675081/get-country-region-name-from-windows-phone-8 – FeliceM Nov 19 '13 at 11:27