Hello.
How can I apply FormatString to Autogenerated columns?
I am using Silverlight DataTable from Telerik blog as an ItemsSource for RadGridView, and columns are autogenerated.
I'd like to format the autogenerated columns based on its data type.
I've found an example of doing this for Silverlight DataGrid, as below.
But as RadGridView's GridViewAutoGeneratingColumnEventArgs class doesn't have PropertyType property, I can't use this example.
How can I apply FormatString to Autogenerated columns?
I am using Silverlight DataTable from Telerik blog as an ItemsSource for RadGridView, and columns are autogenerated.
I'd like to format the autogenerated columns based on its data type.
I've found an example of doing this for Silverlight DataGrid, as below.
But as RadGridView's GridViewAutoGeneratingColumnEventArgs class doesn't have PropertyType property, I can't use this example.
void gridView_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
if (e.PropertyType == typeof(DateTime))
{
DataGridBoundColumn obj = e.Column as DataGridBoundColumn;
if (obj != null && obj.Binding != null)
obj.Binding.StringFormat = "{0:d}";
}
}
Thank you for your support.