Export (0) Print
Expand All

DatePicker.SelectedDateChanged Event

Occurs when the SelectedDate property is changed.

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

'Declaration
Public Event SelectedDateChanged As EventHandler(Of SelectionChangedEventArgs)
<sdk:DatePicker SelectedDateChanged="eventhandler"/>

The following code contains an event handler that updates a TextBlock when SelectedDate is changed.


'Updates a TextBlock with information from the SelectedDateChanged event. 
Private Sub dp2_SelectedDateChanged(ByVal sender As Object, ByVal e As SelectionChangedEventArgs) Handles dp2.SelectedDateChanged
    'RemovedItems will be null if this is the first time a date was selected. 
    If e.RemovedItems Is Nothing OrElse e.RemovedItems.Count = 0 Then
        text1.Text = "Changed SelectedDate from nothing to " + e.AddedItems(0) + "!"
    Else
        text1.Text = "Changed SelectedDate from " + e.RemovedItems(0) + " to " + e.AddedItems(0) + "!"
    End If
End Sub


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