Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Mask Phone number in textbox
Message
De
10/11/2011 16:12:58
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
À
10/11/2011 15:56:21
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Application:
Desktop
Divers
Thread ID:
01528605
Message ID:
01528612
Vues:
51
>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


I would use a ValueConverter...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform