Calendar Control WPF in VB.NET

Here we see, The calendar mostly uses for visual environment. The calendar control is situated in the namespace in the presentationframework dll.
  • 2838


Here we see,  The calendar control is situated in the namespace in the presentationframework dll. The calendar class derives from controlWpf calendar control is a calendar control to be used inside your wpf applications. calendar control used in wpf very easily. Creating calendar not to difficult task in wpf. We can define three modes in calendar control. First is month wise, second is year wise, third is decade. When we use calendar control in wpf we can change its background, we can use its date property, time property etc. For adding the calendar control in our page we can drag and drop from the tool box.

Creating a calendar in our page:

When we creating a calendar firstly we goes to tool box and drag and drop the calendar. after adding calendar control the code of Xaml file look like this.


<Grid DataContext="{Binding}">

<Calendar Height="170" HorizontalAlignment="Left"Margin="29,23,0,0"Name="Calendar1"VerticalAlignment="Top" Width="180" FontWeight="Bold" FontStyle="Normal" DisplayMode="Month" />


The calendar will look like this by default. 


Figure 1

Display Modes:

There are three modes to set the view of calendar by using of display mode property. These modes are month, year, and decade. When we set the display mode month, year and decade the images of calendar will look like this.


Figure 2


Figure 3


Figure 4

Selected dates and selection modes:

The selected date property displays the current date. If multiple date selection is true, then the selected date property displays the currently selected dates. The selection mode of calendar selection mode defines the selection mode of calendar. The selection mode property can be single range, single date, multiple range. we can use these properties by the help of this code.

<Calendar SelectionMode="SingleRange">


We will use single date then we write single date instead of "single range" or if we will use multiple range property then we will write multiple range instead of "single range".

Single date-  only a single date can be selected.

Single range-  a single range of dates can be selected.

Multiple range-  multiple of dates can be selected.

Calendar background- we can change the background of calendar and calendar will look like this.


Figure 5

Code will be in xaml-

LinearGradientBrush StartPoint="0,0" EndPoint="1,1" >
GradientStop Color="Blue" Offset="0.1" />
GradientStop Color="Orange" Offset="0.25" />
GradientStop Color="Green" Offset="0.75" />
GradientStop Color="Red" Offset="1.0" />


More Articles

© 2020 DotNetHeaven. All rights reserved.