Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Mask Phone number in textbox
Message
From
10/11/2011 16:12:58
John Baird
Coatesville, Pennsylvania, United States
 
 
To
10/11/2011 15:56:21
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Application:
Desktop
Miscellaneous
Thread ID:
01528605
Message ID:
01528612
Views:
52
>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...
Previous
Reply
Map
View

Click here to load this message in the networking platform