Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please give your valueable suggestions.
Posted
Comments
Siva Hyderabad 19-Oct-13 2:33am    
question is not clarity?

You can't.

A DataTable is not a presentation item: you don't show it to the world directly (as it isn't derived from Control). Instead you show it via a DataGridView, or A GridView, or a ComboBox or some other data-aware control.
You apply the formatting to the display control, not to the underlying data.
 
Share this answer
 
You can apply formatting for viewing as OriginalGriff said.

Like;
C#
this.dgv_PreviewGrid.DefaultCellStyle.Format = "D4";


Standard Numeric Format Strings
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx[^]


XML
<tk:DataGrid>
    <tk:DataGrid.Columns>
        <tk:DataGridTextColumn Binding="{Binding StartDate, StringFormat=\{0:dd.MM.yy HH:mm:ss\}}" />
    </tk:DataGrid.Columns>
</tk:DataGrid>
 
Share this answer
 
v2
Comments
SRINIVASA RAO T 19-Oct-13 8:28am    
Thank u for your response,please tell me how to apply number format for specific columns in datadridview based on column datatype in wpf.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900