Export (0) Print
Expand All

Calendar.DisplayDateChanged Event

Occurs when the DisplayDate property is changed.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls (in System.Windows.Controls.dll)

public event EventHandler<CalendarDateChangedEventArgs> DisplayDateChanged
<sdk:Calendar DisplayDateChanged="eventhandler"/>

This event occurs after DisplayDate is assigned its new value.

The following event handler updates a TextBox with information from the DisplayDateChanged event. This example is part of a larger example available in the Calendar overview.


//Updates a TextBlock with information from the DisplayDateChanged event.
//This will happen every time the visible month changes, whether triggered
//by user input or by code.
void cal_DisplayDateChanged(object sender, CalendarDateChangedEventArgs e)
{
    //This should never occur unless DisplayDate is explicitly set to null.
    if (e.RemovedDate == null)
    {
        text1.Text = "Changed DisplayDate from null to " + e.AddedDate + "!";
    }
    else
    {
        text1.Text = "Changed DisplayDate from " + e.RemovedDate + " to " + e.AddedDate + "!";
    }
}


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft