Calendar.DisplayDateChanged Event
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Occurs when the DisplayDate property is changed.
Namespace: System.Windows.Controls
Assembly: System.Windows.Controls (in System.Windows.Controls.dll)
Syntax
'Declaration
Public Event DisplayDateChanged As EventHandler(Of CalendarDateChangedEventArgs)
public event EventHandler<CalendarDateChangedEventArgs> DisplayDateChanged
<sdk:Calendar DisplayDateChanged="eventhandler"/>
Examples
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.
Private Sub cal_DisplayDateChanged(ByVal sender As Object, ByVal e As CalendarDateChangedEventArgs) Handles cal.DisplayDateChanged
'This should never occur unless DisplayDate is explicitly set to nothing.
If e.RemovedDate Is Nothing Then
text1.Text = "Changed DisplayDate from nothing to " + e.AddedDate + "!"
Else
text1.Text = "Changed DisplayDate from " + e.RemovedDate + " to " + e.AddedDate + "!"
End If
End Sub
//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 + "!";
}
}
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.