ARTICLE

DatePicker in DataGrid in WPF

Posted by Diptimaya Patra Articles | WPF February 17, 2010
In this article we would see how we can use DatePicker in DataGrid in WPF.
Reader Level:

Introduction

Date Picker is a control available in WPF Toolkit. In this article we would see how we can use DatePicker in DataGrid in WPF.

Crating WPF Application Project

Fire up Visual Studio 2008 and Create a WPF Application and name the project as DatePickerDGWPF.

WPFDate1.gif

Here is the basic idea of our sample application; we will have sample data with one or more datetime properties, which will be displayed in DataGrid.
When the DateTime cell will be in edit mode we will display the DatePicker in the cell instead of TextBox, which is by default.

So let's have a class and have sample data.

WPFDate2.gif

Now we will add a DataGrid to the Window and design the Columns inside of it.

WPFDate3.gif

It seems we are done with the design of our DataGrid columns.

Run the application and try to edit the column "Raised On", you would get DatePicker control to handle the Date and Time.

WPFDate4.gif

WPFDate5.gif

Hope this article helps.

Login to add your contents and source code to this article
post comment
     

Here is nice example of DateTimePicker in DataGrid: http://www.codearsenal.net/2012/03/wpf-datetimepicker-in-datagrid.html

Posted by Yuri Bondarenko May 30, 2012

I understand your idea is to demonstrate the DateTimePicker in DataGridView. how about my posting here? http://www.codeproject.com/Questions/363201/DateTimePicker-in-DataGridView

Posted by TAN THIAM HUAT Apr 10, 2012

Another good topic on DateTimePicker in WPF datagrid: http://clear-code.blogspot.com/2012/03/wpf-datetimepicker-in-datagrid.html

Posted by Yuri Bondarenko Mar 15, 2012
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.