Show / Hide Table of Contents

Class DatePicker

Represents a control that allows the user to select a date.

Inheritance
System.Object
DependencyObject
UIElement
FrameworkElement
Control
DatePicker
Inherited Members
Control.EnableBaseControlHandlingOfVisualStates
Control.ManageIsEnabled(Boolean)
Control.Background
Control.BackgroundProperty
Control.BorderBrush
Control.BorderBrushProperty
Control.BorderThickness
Control.BorderThicknessProperty
Control.FontWeight
Control.FontWeightProperty
Control.FontStyle
Control.FontStyleProperty
Control.Foreground
Control.ForegroundProperty
Control.FontFamily
Control.FontFamilyProperty
Control.FontSize
Control.FontSizeProperty
Control.TextDecorations
Control.TextDecorationsProperty
Control.Padding
Control.PaddingProperty
Control.HorizontalContentAlignment
Control.HorizontalContentAlignmentProperty
Control.VerticalContentAlignment
Control.VerticalContentAlignmentProperty
Control.TabIndex
Control.TabIndexProperty
Control.IsTabStop
Control.IsTabStopProperty
Control.TabNavigation
Control.TabNavigationProperty
Control.Template
Control.TemplateProperty
Control.ApplyTemplate()
Control.GetTemplateChild(String)
Control.Focus()
Control.HandlesScrolling
Control.OnGotFocus(RoutedEventArgs)
Control.OnLostFocus(RoutedEventArgs)
Control.CreateDomElement(Object, Object)
Control.CharacterSpacingProperty
Control.CharacterSpacing
Control.FontStretchProperty
Control.FontStretch
Control.OnDrop(DragEventArgs)
Control.OnDragEnter(DragEventArgs)
Control.OnDragLeave(DragEventArgs)
Control.OnTextInputUpdate(TextCompositionEventArgs)
Control.MeasureOverride(Size)
Control.ArrangeOverride(Size)
FrameworkElement.LayoutUpdated
FrameworkElement.SizeChanged
FrameworkElement.ResourceLookupMode
FrameworkElement.StyleProperty
FrameworkElement.Style
FrameworkElement.DefaultStyleKeyProperty
FrameworkElement.DefaultStyleKey
FrameworkElement.OverridesDefaultStyleProperty
FrameworkElement.OverridesDefaultStyle
FrameworkElement.OnVisualParentChanged(DependencyObject)
FrameworkElement.VisualChildrenCount
FrameworkElement.GetVisualChild(Int32)
FrameworkElement.Parent
FrameworkElement.AddLogicalChild(Object)
FrameworkElement.RemoveLogicalChild(Object)
FrameworkElement.LogicalChildren
FrameworkElement.TemplatedParent
FrameworkElement.Resources
FrameworkElement.IsLoaded
FrameworkElement.SetBinding(DependencyProperty, BindingBase)
FrameworkElement.SetBinding(DependencyProperty, Binding)
FrameworkElement.GetBindingExpression(DependencyProperty)
FrameworkElement.Cursor
FrameworkElement.CursorProperty
FrameworkElement.FindName(String)
FrameworkElement.Name
FrameworkElement.NameProperty
FrameworkElement.DataContext
FrameworkElement.DataContextProperty
FrameworkElement.DataContextChanged
FrameworkElement.Triggers
FrameworkElement.FlowDirectionProperty
FrameworkElement.FlowDirection
FrameworkElement.LanguageProperty
FrameworkElement.Language
FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs)
FrameworkElement.Tag
FrameworkElement.TagProperty
FrameworkElement.LoadedEvent
FrameworkElement.Loaded
FrameworkElement.Unloaded
FrameworkElement.BindingValidationError
FrameworkElement.ContextMenuProperty
FrameworkElement.ContextMenu
FrameworkElement.ContextMenuOpening
FrameworkElement.ToolTipProperty
FrameworkElement.ToolTip
FrameworkElement.INTERNAL_OnDetachedFromVisualTree()
FrameworkElement.INTERNAL_OnAttachedToVisualTree()
FrameworkElement.Height
FrameworkElement.HeightProperty
FrameworkElement.Width
FrameworkElement.WidthProperty
FrameworkElement.HorizontalAlignment
FrameworkElement.HorizontalAlignmentProperty
FrameworkElement.VerticalAlignment
FrameworkElement.VerticalAlignmentProperty
FrameworkElement.Margin
FrameworkElement.MarginProperty
FrameworkElement.MinHeight
FrameworkElement.MinHeightProperty
FrameworkElement.MinWidth
FrameworkElement.MinWidthProperty
FrameworkElement.MaxHeight
FrameworkElement.MaxHeightProperty
FrameworkElement.MaxWidth
FrameworkElement.MaxWidthProperty
FrameworkElement.ActualWidthProperty
FrameworkElement.ActualWidth
FrameworkElement.ActualHeightProperty
FrameworkElement.ActualHeight
UIElement.TransformToVisual(UIElement)
UIElement.RenderSize
UIElement.DesiredSize
UIElement.InvalidateMeasure()
UIElement.InvalidateArrange()
UIElement.Measure(Size)
UIElement.Arrange(Rect)
UIElement.UpdateLayout()
UIElement.DragEnter
UIElement.DragLeave
UIElement.Drop
UIElement.DragOver
UIElement.CacheMode
UIElement.CacheModeProperty
UIElement.Projection
UIElement.ProjectionProperty
UIElement.VisualParent
UIElement.AddVisualChild(UIElement)
UIElement.RemoveVisualChild(UIElement)
UIElement.OnVisualChildrenChanged(DependencyObject, DependencyObject)
UIElement.XamlSourcePath
UIElement.ClipToBounds
UIElement.ClipToBoundsProperty
UIElement.ClipProperty
UIElement.Clip
UIElement.IsEnabledProperty
UIElement.IsEnabled
UIElement.IsEnabledChanged
UIElement.EffectProperty
UIElement.Effect
UIElement.RenderTransformProperty
UIElement.RenderTransform
UIElement.RenderTransformOriginProperty
UIElement.RenderTransformOrigin
UIElement.UseLayoutRounding
UIElement.UseLayoutRoundingProperty
UIElement.Visibility
UIElement.VisibilityProperty
UIElement.IsVisibleProperty
UIElement.IsVisible
UIElement.IsVisibleChanged
UIElement.OpacityProperty
UIElement.Opacity
UIElement.OpacityMaskProperty
UIElement.OpacityMask
UIElement.IsHitTestVisible
UIElement.IsHitTestVisibleProperty
UIElement.AllowDrop
UIElement.AllowDropProperty
UIElement.CaptureMouse()
UIElement.IsMouseCaptured
UIElement.ReleaseMouseCapture()
UIElement.AllowScrollOnTouchMove
UIElement.AllowScrollOnTouchMoveProperty
UIElement.AddHandler(RoutedEvent, Delegate, Boolean)
UIElement.RemoveHandler(RoutedEvent, Delegate)
UIElement.MouseMoveEvent
UIElement.MouseMove
UIElement.OnMouseMove(MouseEventArgs)
UIElement.MouseLeftButtonDownEvent
UIElement.MouseLeftButtonDown
UIElement.OnMouseLeftButtonDown(MouseButtonEventArgs)
UIElement.MouseRightButtonDownEvent
UIElement.MouseRightButtonDown
UIElement.OnMouseRightButtonDown(MouseButtonEventArgs)
UIElement.MouseWheelEvent
UIElement.MouseWheel
UIElement.MouseLeftButtonUpEvent
UIElement.MouseLeftButtonUp
UIElement.OnMouseLeftButtonUp(MouseButtonEventArgs)
UIElement.MouseEnterEvent
UIElement.MouseEnter
UIElement.OnMouseEnter(MouseEventArgs)
UIElement.MouseLeaveEvent
UIElement.MouseLeave
UIElement.OnMouseLeave(MouseEventArgs)
UIElement.TextInputStartEvent
UIElement.TextInputStart
UIElement.OnTextInputStart(TextCompositionEventArgs)
UIElement.TextInputEvent
UIElement.TextInput
UIElement.OnTextInput(TextCompositionEventArgs)
UIElement.TextInputUpdateEvent
UIElement.TextInputUpdate
UIElement.TappedEvent
UIElement.Tapped
UIElement.OnTapped(TappedRoutedEventArgs)
UIElement.MouseRightButtonUpEvent
UIElement.MouseRightButtonUp
UIElement.OnMouseRightButtonUp(MouseButtonEventArgs)
UIElement.KeyDownEvent
UIElement.KeyDown
UIElement.OnKeyDown(KeyEventArgs)
UIElement.KeyUpEvent
UIElement.KeyUp
UIElement.OnKeyUp(KeyEventArgs)
UIElement.GotFocusEvent
UIElement.GotFocus
UIElement.LostFocusEvent
UIElement.LostFocus
UIElement.LostMouseCapture
UIElement.OnLostMouseCapture(MouseEventArgs)
UIElement.INTERNAL_AttachToDomEvents()
UIElement.INTERNAL_DetachFromDomEvents()
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: System.Windows.Controls
Assembly: OpenSilver.Controls.dll
Syntax
[TemplatePart(Name = "Root", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "TextBox", Type = typeof(DatePickerTextBox))]
[TemplatePart(Name = "Button", Type = typeof(Button))]
[TemplatePart(Name = "Popup", Type = typeof(Popup))]
[StyleTypedProperty(Property = "CalendarStyle", StyleTargetType = typeof(Calendar))]
public class DatePicker : Control, IControl, IFrameworkElement, IUIElement, IDependencyObject

Constructors

| Improve this Doc View Source

DatePicker()

Initializes a new instance of the DatePicker class.

Declaration
public DatePicker()

Fields

| Improve this Doc View Source

CalendarStyleProperty

Identifies the CalendarStyle dependency property.

Declaration
public static readonly DependencyProperty CalendarStyleProperty
Field Value
Type Description
DependencyProperty

The identifier for the CalendarStyle dependency property.

| Improve this Doc View Source

DisplayDateEndProperty

Identifies the DisplayDateEnd dependency property.

Declaration
public static readonly DependencyProperty DisplayDateEndProperty
Field Value
Type Description
DependencyProperty

The identifier for the DisplayDateEnd dependency property.

| Improve this Doc View Source

DisplayDateProperty

Identifies the DisplayDate dependency property.

Declaration
public static readonly DependencyProperty DisplayDateProperty
Field Value
Type Description
DependencyProperty

The identifier for the DisplayDate dependency property.

| Improve this Doc View Source

DisplayDateStartProperty

Identifies the DisplayDateStart dependency property.

Declaration
public static readonly DependencyProperty DisplayDateStartProperty
Field Value
Type Description
DependencyProperty

The identifier for the DisplayDateStart dependency property.

| Improve this Doc View Source

FirstDayOfWeekProperty

Identifies the FirstDayOfWeek dependency property.

Declaration
public static readonly DependencyProperty FirstDayOfWeekProperty
Field Value
Type Description
DependencyProperty

The identifier for the FirstDayOfWeek dependency property.

| Improve this Doc View Source

IsDropDownOpenProperty

Identifies the IsDropDownOpen dependency property.

Declaration
public static readonly DependencyProperty IsDropDownOpenProperty
Field Value
Type Description
DependencyProperty

The identifier for the IsDropDownOpen dependency property.

| Improve this Doc View Source

IsTodayHighlightedProperty

Identifies the IsTodayHighlighted dependency property.

Declaration
public static readonly DependencyProperty IsTodayHighlightedProperty
Field Value
Type Description
DependencyProperty

The identifier for the IsTodayHighlighted dependency property.

| Improve this Doc View Source

SelectedDateFormatProperty

Identifies the SelectedDateFormat dependency property.

Declaration
public static readonly DependencyProperty SelectedDateFormatProperty
Field Value
Type Description
DependencyProperty

The identifier for the SelectedDateFormat dependency property.

| Improve this Doc View Source

SelectedDateProperty

Identifies the SelectedDate dependency property.

Declaration
public static readonly DependencyProperty SelectedDateProperty
Field Value
Type Description
DependencyProperty

The identifier for the SelectedDate dependency property.

| Improve this Doc View Source

SelectionBackgroundProperty

Identifies the SelectionBackground dependency property.

Declaration
public static readonly DependencyProperty SelectionBackgroundProperty
Field Value
Type Description
DependencyProperty

The identifier for the SelectionBackground dependency property.

| Improve this Doc View Source

TextProperty

Identifies the Text dependency property.

Declaration
public static readonly DependencyProperty TextProperty
Field Value
Type Description
DependencyProperty

The identifier for the Text dependency property.

Properties

| Improve this Doc View Source

BlackoutDates

Gets a collection of dates that are marked as not selectable.

Declaration
public CalendarBlackoutDatesCollection BlackoutDates { get; }
Property Value
Type Description
CalendarBlackoutDatesCollection

A collection of dates that cannot be selected. The default value is an empty collection.

| Improve this Doc View Source

CalendarStyle

Gets or sets the style that is used when rendering the calendar.

Declaration
public Style CalendarStyle { get; set; }
Property Value
Type Description
Style

The style that is used when rendering the calendar.

| Improve this Doc View Source

DisplayDate

Gets or sets the date to display.

Declaration
[TypeConverter(typeof(DateTimeTypeConverter))]
public DateTime DisplayDate { get; set; }
Property Value
Type Description
System.DateTime

The date to display. The default System.DateTime.Today.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

The specified date is not in the range defined by DisplayDateStart and DisplayDateEnd.

| Improve this Doc View Source

DisplayDateEnd

Gets or sets the last date to be displayed.

Declaration
[TypeConverter(typeof(DateTimeTypeConverter))]
public DateTime? DisplayDateEnd { get; set; }
Property Value
Type Description
System.Nullable<System.DateTime>

The last date to display.

| Improve this Doc View Source

DisplayDateStart

Gets or sets the first date to be displayed.

Declaration
[TypeConverter(typeof(DateTimeTypeConverter))]
public DateTime? DisplayDateStart { get; set; }
Property Value
Type Description
System.Nullable<System.DateTime>

The first date to display.

| Improve this Doc View Source

FirstDayOfWeek

Gets or sets the day that is considered the beginning of the week.

Declaration
public DayOfWeek FirstDayOfWeek { get; set; }
Property Value
Type Description
System.DayOfWeek

A System.DayOfWeek representing the beginning of the week. The default is System.DayOfWeek.Sunday.

| Improve this Doc View Source

IsDropDownOpen

Gets or sets a value indicating whether the drop-down Calendar is open or closed.

Declaration
public bool IsDropDownOpen { get; set; }
Property Value
Type Description
System.Boolean

True if the Calendar is open; otherwise, false. The default is false.

| Improve this Doc View Source

IsTodayHighlighted

Gets or sets a value indicating whether the current date will be highlighted.

Declaration
public bool IsTodayHighlighted { get; set; }
Property Value
Type Description
System.Boolean

True if the current date is highlighted; otherwise, false. The default is true.

| Improve this Doc View Source

SelectedDate

Gets or sets the currently selected date.

Declaration
[TypeConverter(typeof(DateTimeTypeConverter))]
public DateTime? SelectedDate { get; set; }
Property Value
Type Description
System.Nullable<System.DateTime>

The date currently selected. The default is null.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

The specified date is not in the range defined by DisplayDateStart and DisplayDateEnd, or the specified date is in the BlackoutDates collection.

| Improve this Doc View Source

SelectedDateFormat

Gets or sets the format that is used to display the selected date.

Declaration
public DatePickerFormat SelectedDateFormat { get; set; }
Property Value
Type Description
DatePickerFormat

The format that is used to display the selected date. The default is Short.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

An specified format is not valid.

| Improve this Doc View Source

SelectionBackground

Gets or sets the background used for selected dates.

Declaration
public Brush SelectionBackground { get; set; }
Property Value
Type Description
Brush

The background used for selected dates.

| Improve this Doc View Source

Text

Gets or sets the text that is displayed by the DatePicker.

Declaration
public string Text { get; set; }
Property Value
Type Description
System.String

The text displayed by the DatePicker.

Exceptions
Type Condition
System.FormatException

The text entered cannot be parsed to a valid date, and the exception is not suppressed.

System.ArgumentOutOfRangeException

The text entered parses to a date that is not selectable.

Methods

| Improve this Doc View Source

OnApplyTemplate()

Builds the visual tree for the DatePicker control when a new template is applied.

Declaration
public override void OnApplyTemplate()
Overrides
Control.OnApplyTemplate()
| Improve this Doc View Source

OnCreateAutomationPeer()

Returns a DatePickerAutomationPeer for use by the Silverlight automation infrastructure.

Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type Description
AutomationPeer

A DatePickerAutomationPeer for the DatePicker object.

Overrides
UIElement.OnCreateAutomationPeer()
| Improve this Doc View Source

OnDateValidationError(DatePickerDateValidationErrorEventArgs)

Raises the DateValidationError event.

Declaration
protected virtual void OnDateValidationError(DatePickerDateValidationErrorEventArgs e)
Parameters
Type Name Description
DatePickerDateValidationErrorEventArgs e

A DatePickerDateValidationErrorEventArgs that contains the event data.

| Improve this Doc View Source

OnMouseWheel(MouseWheelEventArgs)

Default mouse wheel handler for the DatePicker control.

Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type Name Description
MouseWheelEventArgs e

Mouse wheel event args.

Overrides
UIElement.OnMouseWheel(MouseWheelEventArgs)
| Improve this Doc View Source

ToString()

Provides a text representation of the selected date.

Declaration
public override string ToString()
Returns
Type Description
System.String

A text representation of the selected date, or an empty string if SelectedDate is a null reference.

Overrides
System.Object.ToString()

Events

| Improve this Doc View Source

CalendarClosed

Occurs when the drop-down Calendar is closed.

Declaration
public event RoutedEventHandler CalendarClosed
Event Type
Type Description
RoutedEventHandler
| Improve this Doc View Source

CalendarOpened

Occurs when the drop-down Calendar is opened.

Declaration
public event RoutedEventHandler CalendarOpened
Event Type
Type Description
RoutedEventHandler
| Improve this Doc View Source

DateValidationError

Occurs when Text is assigned a value that cannot be interpreted as a date.

Declaration
public event EventHandler<DatePickerDateValidationErrorEventArgs> DateValidationError
Event Type
Type Description
System.EventHandler<DatePickerDateValidationErrorEventArgs>
| Improve this Doc View Source

SelectedDateChanged

Occurs when the SelectedDate property is changed.

Declaration
public event EventHandler<SelectionChangedEventArgs> SelectedDateChanged
Event Type
Type Description
System.EventHandler<SelectionChangedEventArgs>

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
UIElementExtendedRoutedEventExtensions.AddHandler(UIElement, ExtendedRoutedEvent, Delegate, Boolean)
UIElementExtendedRoutedEventExtensions.RemoveHandler(UIElement, ExtendedRoutedEvent, Delegate)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
VisualTreeExtensions.GetBoundsRelativeTo(FrameworkElement, UIElement)
VisualTreeExtensions.InvokeOnLayoutUpdated(FrameworkElement, Action)
  • Improve this Doc
  • View Source