我想以下列方式将数千个分隔符应用于数据网格视图的列,但同时我想将CultureInfo“de-DE”应用于绑定。如何将CultureInfo.GetCultureInfo("de-DE")
设置为以下语句。
private void preview_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
DataGridTextColumn col = e.Column as DataGridTextColumn;
if (col != null && e.PropertyType == typeof(decimal) || e.PropertyType == typeof(double) || e.PropertyType==typeof(float))
{
col.Binding = new Binding(e.PropertyName) { StringFormat = "{0:n}"};//here I want to use CultureInfo.
}
}
答案 0 :(得分:0)
private void preview_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
DataGridTextColumn col = e.Column as DataGridTextColumn;
if (col != null && e.PropertyType == typeof(decimal) || e.PropertyType == typeof(double) || e.PropertyType==typeof(float))
{
col.Binding = new Binding(e.PropertyName) { StringFormat = "{0:n}", ConverterCulture = CultureInfo.GetCultureInfo("de-DE")};//here I want to use CultureInfo.
}
}