docs / articles / Add Microsoft Date & Time Picker

Add Microsoft Date & Time Picker

Eric Jul 09, 2026 2026-07-09 04:40:47

Streamlining your workflow often involves integrating intuitive tools that can save time and reduce errors. When it comes to handling dates and times in your applications, Microsoft's Date and Time Picker control can be an invaluable addition. This control allows users to select dates and times easily, enhancing user experience and improving data accuracy. Let's delve into how you can add this control to your applications.

Microsoft Date and Time Picker Control - How To Enable and Use It
Microsoft Date and Time Picker Control - How To Enable and Use It

Before we proceed, ensure you have the necessary prerequisites. You'll need to have Microsoft's .NET Framework or .NET Core installed, along with a text editor or Integrated Development Environment (IDE) like Visual Studio. Once you've got these set up, you're ready to start adding the Date and Time Picker control.

How to Add an Updating Date and Time in Microsoft Word (PC & Mac)
How to Add an Updating Date and Time in Microsoft Word (PC & Mac)

Adding Microsoft Date and Time Picker Control

The first step in adding the Date and Time Picker control is to include the necessary namespaces in your code. This allows your application to recognize and utilize the control's functionalities.

How to create a drop down list calendar (date picker) in Excel?
How to create a drop down list calendar (date picker) in Excel?

Here's how you can do it in C#:

Including Namespaces

How to insert dates from a Popup Calendar (date picker) in Excel – user guide | XLTools
How to insert dates from a Popup Calendar (date picker) in Excel – user guide | XLTools

In your .cs file, add the following lines at the top, just below the using directives:

```csharp using System.Windows.Controls; using System.Windows.Controls.Primitives; ```

These namespaces provide access to the DatePicker and DateTimePicker controls.

Adding the Control to Your XAML

Excel VBA USERFORMS #25 Date Picker Calendar revealed! Loop through Userforms and Controls  Example
Excel VBA USERFORMS #25 Date Picker Calendar revealed! Loop through Userforms and Controls Example

Next, you'll need to add the DatePicker or DateTimePicker control to your XAML. Here's how you can do it:

```xml ```

Or for a DateTimePicker:

```xml ```

In both examples, the control is given a name, and the SelectedDate property is set to the current date.

How to Add Date Picker Calendar Drop Down in MS Excel (Easy)
How to Add Date Picker Calendar Drop Down in MS Excel (Easy)

Customizing the Date and Time Picker Control

Now that you've added the control, you might want to customize it to fit your application's theme or user needs.

How to Set or Change a Computer's Date and Time
How to Set or Change a Computer's Date and Time
Excel Date Picker - How to Insert? (Step by Step Examples)
Excel Date Picker - How to Insert? (Step by Step Examples)
Use This Free Excel Date Picker to Enter Dates on Worksheet
Use This Free Excel Date Picker to Enter Dates on Worksheet
How to Create a Timestamp in Excel
How to Create a Timestamp in Excel
an image of a calendar in microsoft office 365 with the date and time tab open
an image of a calendar in microsoft office 365 with the date and time tab open
two different screens with the same time and date
two different screens with the same time and date
How to Quickly Insert Date And Time In Excel
How to Quickly Insert Date And Time In Excel
the date picker app is displayed on an iphone's screen, with time remaining
the date picker app is displayed on an iphone's screen, with time remaining
Never waste time typing out dates again with this calendar tool. 🗓
Never waste time typing out dates again with this calendar tool. 🗓
MS Outlook Calendar: How to Add, Share, & Use It Right | Envato Tuts+
MS Outlook Calendar: How to Add, Share, & Use It Right | Envato Tuts+
28 Datepickers for Website UI and Mobile Apps - Bittbox
28 Datepickers for Website UI and Mobile Apps - Bittbox
Calculate days from/before date in Excel
Calculate days from/before date in Excel
Excel date picker add-in — Rad Sheets
Excel date picker add-in — Rad Sheets
Figma Date Picker Components - ani bazuashvili
Figma Date Picker Components - ani bazuashvili
Date Picker - SquareUi
Date Picker - SquareUi
an iphone showing the date and time app
an iphone showing the date and time app
Responsive Time Picker UI Design with HTML CSS JavaScript Free Download  Modern Dark Theme
Responsive Time Picker UI Design with HTML CSS JavaScript Free Download Modern Dark Theme
How do I revert back to the (old) numerical date & time pickers?
How do I revert back to the (old) numerical date & time pickers?
Mastering Excel Date & Time: Serial numbers, Networkdays, Datevalue, and more
Mastering Excel Date & Time: Serial numbers, Networkdays, Datevalue, and more
the date and time functions in excel, with instructions to use it for each task
the date and time functions in excel, with instructions to use it for each task

Styling the Control

You can style the control using the Style property and applying a custom style. Here's an example:

```xml ```

In this case, "MyDatePickerStyle" should be defined elsewhere in your XAML with the desired styles.

Formatting the Display

You can also format the display of the selected date or time using the DisplayDateFormat property. For example:

```xml ```

This will display the selected date in the format "day/month/year".

Limiting the Selection Range

If you want to restrict the dates users can select, you can use the BlackoutDates property. Here's how you can black out dates in the past:

```xml ```

This will prevent users from selecting dates before 2000 or after 2020.

Remember, the key to a successful integration is understanding your users' needs and tailoring the control to meet those needs. With a bit of customization, the Date and Time Picker control can greatly enhance your application's usability.

In the ever-evolving landscape of software development, staying updated with the latest tools and techniques is crucial. By mastering the Microsoft Date and Time Picker control, you've taken a significant step towards streamlining your workflow and improving user experience. So, go ahead, experiment with the control, and watch as your applications become more intuitive and user-friendly.