#363 – Calendar Control Basics

The Calendar control displays an image of a calendar and allows a user to select a date.  By default, the calendar shows a single month that includes the current date.

    <StackPanel HorizontalAlignment="Center" Margin="15">
        <Calendar Name="cal"/>
        <Label Content="{Binding ElementName=cal, Path=SelectedDate, StringFormat=d}"/>
    </StackPanel>

When the user selects a date on the calendar, the SelectedDate property indicates the day that was selected.

You can use the left and right arrow icons at the top of the control to navigate to the previous/next month.

The Calendar control can also display a single year, or a single decade.  To switch to the Year mode, click on the name of the month at the top of the control.

You can now navigate to the previous/next year using the arrows, or click on a specific month.

You can switch to Decade mode by clicking on the year at the top of the control.

About these ads

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

3 Responses to #363 – Calendar Control Basics

  1. Brack Bhuvan says:

    Very nice article. I really enjoyed it reading. And it also cleared lot of my doubts about Calendar Control in WPF. I’ve found some other good article related to this post over internet which also explained very well you may check out this links….

    http://mindstick.com/Articles/47af6cd1-5ddd-4a9c-a862-27a90dd5da31/?Calendar%20Control%20in%20WPF

    http://www.c-sharpcorner.com/uploadfile/mahesh/wpf-calendar-control/

    http://www.c-sharpcorner.com/uploadfile/mahesh/wpf-calendar-control/

  2. Pingback: #1,034 – Limiting the Range of Selectable Dates in a Calendar | 2,000 Things You Should Know About WPF

  3. Pingback: #1,035 – DatePicker Basics | 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 381 other followers

%d bloggers like this: