WPF 中DataGrid控件日期显示的格式化
2017-03-31 00:14
92 查看
来源:http://stackoverflow.com/questions/7978249/date-formatting-in-wpf-datagrid
使用这个方法,仍然可以使用 AutoGenerateColumns 属性,非常方便!
Very late to the party here but in case anyone else stumbles across this page...
You can do it by setting the AutoGeneratingColumn handler in XAML:
And then in behind code do something like this:
使用这个方法,仍然可以使用 AutoGenerateColumns 属性,非常方便!
Very late to the party here but in case anyone else stumbles across this page...
You can do it by setting the AutoGeneratingColumn handler in XAML:
<DataGrid AutoGeneratingColumn="OnAutoGeneratingColumn" ..etc.. />
And then in behind code do something like this:
private void OnAutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e) { if (e.PropertyType == typeof(System.DateTime)) (e.Column as DataGridTextColumn).Binding.StringFormat = "dd/MM/yyyy"; }
相关文章推荐
- Asp.net日期字符串格式化显示方法[转]
- C# DateTime日期类型格式化显示
- 如何使用Javascript格式化日期显示
- Asp.net日期字符串格式化显示方法
- 格式化显示(日期\货币)
- C#(ASP.NET)DateTime日期类型格式化显示
- 有关日期类型格式化显示
- Asp.net日期字符串格式化显示
- 如何使用Javascript格式化日期显示
- 日期格式化显示
- Asp.net日期字符串格式化显示
- 日期格式化显示
- Asp.net日期字符串格式化显示
- C#(ASP.NET)DateTime日期类型格式化显示
- C#DateTime日期类型格式化显示
- C# DateTime日期类型格式化显示
- [NET]Asp.net日期字符串格式化显示--DateTime.ToString()用法详解
- Asp.net日期字符串格式化显示
- C#(ASP.NET)DateTime日期类型格式化显示 (转载)
- DateTime日期类型格式化显示