Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Mask Phone number in textbox
Message
De
10/11/2011 15:56:21
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
How to Mask Phone number in textbox
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Application:
Desktop
Divers
Thread ID:
01528605
Message ID:
01528605
Vues:
90
I have a WPF Window with a DataGrid. This DataGrid contains a phone number column. The phone number is stored as a string without any formatting such as "9995551234".

How can I display the phone number column with the following format? (999)555-1234

Here is the phone column of my DataGrid with the format that I have tried but this does not work.

DataGridTemplateColumn Header="Phone" Width="100"
DataGridTemplateColumn.CellTemplate
DataTemplate
TextBlock Text="{Binding PhoneNumber, StringFormat={}{0:(###)###-####}}" Width="100"
DataTemplate
DataGridTemplateColumn.CellTemplate
DataGridTemplateColumn.CellEditingTemplate
DataTemplate
TextBox Text="{Binding PhoneNumber, StringFormat={}{0:(###)###-####}}" Width="100"
DataTemplate
DataGridTemplateColumn.CellEditingTemplate
DataGridTemplateColumn
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform