0
我在XAML中爲我的日期有以下datagrid列。我需要格式化爲「MM/dd/yyyy」格式。在C中設置DataGrid StringFormat#
<sdk:DataGridTextColumn Width="Auto" Binding="{Binding MyDate, StringFormat='MM/dd/yyyy'}" Header="Date" />
如何在C#中重現字符串格式化部分?我想在代碼中將新列添加到我的Datagrid中。
DataGridTextColumn textColumn = new DataGridTextColumn();
textColumn.Header = "Date";
textColumn.Binding = new Binding("MyDate");
textColumn.CanUserReorder = true;
//????
this.MyDataGrid.Columns.Add(textColumn);