The GridViewDataColumn and the GridViewComboBoxColumn allow you to format the data displayed in them. To do that you have to specify a format string appropriate for the data displayed and set it to the DataFormatString property of the column.
CopyXAML
<telerik:GridViewDataColumn DataMemberBinding="{Binding OrderDate}"
Header="Order Date"
UniqueName="OrderDate"
DataFormatString="{} {0:dd, MMM, yyyy}" /> Tip |
|---|
| Defining format strings in XAML can be done in the following way- {}:{0:your format string}. |
CopyC#
( ( GridViewDataColumn )this.radGridView.Columns[ "OrderDate" ] ).DataFormatString = "{0:dd, MMM, yyyy}";
CopyVB.NET
DirectCast(Me.radGridView.Columns("OrderDate"), GridViewDataColumn).DataFormatString = "{0:dd, MMM, yyyy}" Note |
|---|
DataFormatString is plain string.Format. To learn more please check this MSDN article:
string.Format |
Note |
|---|
{} is the XAML escape sequence. You can find again more information in MSDN:
Escape Sequence |
To learn more about formatting visit the Formatting Overview chapter in MSDN.
Caution |
|---|
If you set a StringFormat in the Binding expression and the DataFormatString, the DataFormatString will apply. |
See Also