DatePickerDateValidationErrorEventArgs Class
Provides data for the DatePicker::DateValidationError event.
Assembly: PresentationFramework (in PresentationFramework.dll)
The DatePickerDateValidationErrorEventArgs type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DatePickerDateValidationErrorEventArgs | Initializes a new instance of the DatePickerDateValidationErrorEventArgs class. |
| Name | Description | |
|---|---|---|
![]() | Exception | Gets the initial exception associated with the DateValidationError event. |
![]() | Text | Gets or sets the text that caused the DateValidationError event. |
![]() | ThrowException | Gets or sets a value that indicates whether Exception should be thrown. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The DatePicker::DateValidationError event occurs when DatePicker::Text is set to a value that cannot be interpreted as a date or when the date cannot be selected. You can subscribe to this event and specify whether an exception is raised by setting the ThrowException property. If DatePickerDateValidationErrorEventArgs::ThrowException is true, one of the following exceptions is raised:
Exception type | Condition |
|---|---|
The text entered cannot be parsed to a valid date, and the exception is not suppressed. | |
The text entered parses to a date that is not selectable. |
If DatePickerDateValidationErrorEventArgs::ThrowException is false, the application continues execution as usual.
The following example creates a DatePicker that displays the dates in August 2009 and specifies that each Saturday and Sunday is not selectable. The DatePicker handles the DateValidationError event. If the user enters a date that is not selectable, the example displays a message. If the user enters text that is not a valid date, an exception is thrown.
<DatePicker Name="datePickerWithBlackoutDates" DisplayDateStart="8/1/09" DisplayDateEnd="8/31/09" SelectedDate="8/10/09" DateValidationError="DatePicker_DateValidationError"> <DatePicker.BlackoutDates> <CalendarDateRange Start="8/1/09" End="8/2/09"/> <CalendarDateRange Start="8/8/09" End="8/9/09"/> <CalendarDateRange Start="8/15/09" End="8/16/09"/> <CalendarDateRange Start="8/22/09" End="8/23/09"/> <CalendarDateRange Start="8/29/09" End="8/30/09"/> </DatePicker.BlackoutDates> </DatePicker>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
