#371 – Specifying a Default Date for a Calendar Control to Display

When you use a Calendar control, it will default to showing the current date when the application starts.

You can override the default date displayed by setting the DisplayDate property.

        <Calendar SelectionMode="SingleDate" DisplayDate="7/20/1969"/>


You can also specify a range of dates that the Calendar control is allowed to display by using the DisplayDateStart and DisplayDateEnd properties.

        <Calendar SelectionMode="SingleDate" DisplayDateStart="12/7/1941" DisplayDateEnd="8/14/1945"/>

The Calendar control will now allow selecting only dates that fall within this time period.  When you navigate to the month containing the earliest date, you’ll be unable to navigate further back in time.  Similarly, you’ll be unable to navigate to a date later than the date specified in the DisplayDateEnd property.


Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #371 – Specifying a Default Date for a Calendar Control to Display

  1. Pingback: Dew Drop – August 24, 2011 | Alvin Ashcraft's Morning Dew

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: