Click here to Skip to main content
15,662,459 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello i have a datagridview -created progmatically in wpf- and i populated datas with this code

dataGrid1.ItemsSource = dt.DefaultView;

But date columns was shown like this

4/24/2015 12:00:00 AM

How can i see date columns as 24/04/2015 ?

1 solution

Try this,
dataGrid1.ItemsSource = objTable.DefaultView;
DataGridTextColumn objTextColumn = (DataGridTextColumn)dataGrid1.Columns[0];
objTextColumn.Binding.StringFormat = "{0:dd/MM/yyyy}";
Share this answer
enoua 9-Sep-15 10:27am    
Thank you but it provides another problem for me. When I change column as your string format I cannot entry 23/05/2015 to cell. It gives error.

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