We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set datetime format for column when AutoGenerateColumns is true

Platform: WPF |
Control: SfDataGrid |
.NET Framework: 4.5 |
Product Version:

AutoGeneratingColumn event is trigger while SfDataGrid generates the columns when the Grid is loaded. This event receives two arguments: sender and AutoGeneratingColumnArgs. You can modify the property setting of auto generated columns by handling this event.

GridDataTimeColumn is one of the column type of SfDataGrid. It supports Pattern property. Using this property, you can set the date and time pattern to display the column values. This property is type of DataTimePattern. It is a enum type and it supports the following values,

CustomPattern: It is used to customize the DataTime Pattern.

ShortDate: It is used to set the standard ShortDate Pattern.

LongDate: It is used to set the standard LongDate Pattern.

ShortTime: It is used to set the standard ShortTime Pattern.

LongTime: It is used to set the standard LongTime Pattern.

FullDateTime: It is used to set the standard FullDateTime Pattern.

MonthDay: It is used to set the standard MonthDay Pattern.

RFC1123: It is used to set the standard RFC1123 Pattern.

ShortableDateTime: It is used to set the standard ShortableDateTime Pattern.

UniversalShortableDateTime: It is used to set the standard UniversalShortableDateTime Pattern.

YearMonth: It is used to set the standard YearMonth Pattern.


In the below code snippet, GridDateTimeColumn.Pattern property changed for auto generated column.




Full Date and time is displayed in the EmployeeDate column based on the FullDateTime pattern.

The following screenshot displays the full date and time for EmployeeDate column.


Sample Link:

WPF: DateTimePattern_of_SfDataGrid_WPF.zip
SilverLight: DateTimePattern_of_SfDataGrid_SilverLight.zip

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile