Class DateTimePickerBase
Represents a class which is used to maintain the common codes of SfDatePicker, SfTimePicker, and SfCalendarDatePicker controls.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Editors
Assembly: Syncfusion.Editors.WinUI.dll
Syntax
public class DateTimePickerBase : SfDropDownBase, IDisposable
Constructors
DateTimePickerBase()
Initializes a new instance of the DateTimePickerBase class.
Declaration
public DateTimePickerBase()
Fields
AllowNullProperty
Identifies AllowNull dependency property.
Declaration
public static readonly DependencyProperty AllowNullProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.UI.Xaml.DependencyProperty | The identifier for the AllowNull dependency property. |
DescriptionProperty
Identifies Description dependency property.
Declaration
public static readonly DependencyProperty DescriptionProperty
Field Value
| Type |
|---|
| Microsoft.UI.Xaml.DependencyProperty |
EditModeProperty
Identifies EditMode dependency property.
Declaration
public static readonly DependencyProperty EditModeProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.UI.Xaml.DependencyProperty | The identifier for the EditMode dependency property. |
HeaderProperty
Identifies Header dependency property.
Declaration
public static readonly DependencyProperty HeaderProperty
Field Value
| Type |
|---|
| Microsoft.UI.Xaml.DependencyProperty |
HeaderTemplateProperty
Identifies HeaderTemplate dependency property.
Declaration
public static readonly DependencyProperty HeaderTemplateProperty
Field Value
| Type |
|---|
| Microsoft.UI.Xaml.DependencyProperty |
ShowClearButtonProperty
Identifies ShowClearButton dependency property.
Declaration
public static readonly DependencyProperty ShowClearButtonProperty
Field Value
| Type | Description |
|---|---|
| Microsoft.UI.Xaml.DependencyProperty | The identifier for the ShowClearButton dependency property. |
Properties
AllowNull
Gets or sets a value indicating whether the DateTimePickerBase allows null value or not.
Declaration
public bool AllowNull { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true when DateTimePickerBase allows null value input, otherwise false. The default value is true. |
Remarks
PlaceHolderText will be shown in editor, when AllowNull is null.
Description
Gets or sets content that is shown below the control. The content should provide guidance about the input expected by the control.
Declaration
public object Description { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Object | The default value is |
Examples
Set string as description.
<!-- String description -->
<editor:SfTimePicker Description = "Start time" />
Set a control as description.
<!-- TextBlock as description -->
<editor:SfDatePicker>
<editor:SfDatePicker.Description>
<TextBlock Text = "Date of birth" FontWeight="Bold"/>
</editor:SfDatePicker.Description>
</editor:SfDatePicker>
EditMode
Gets or sets a value indicating how to edit the date or time.
Declaration
public DateTimeEditMode EditMode { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTimeEditMode | The default value is Mask. |
Remarks
Date value can be edited using a text box in editor part. To disable editing set None value. To perform input validation as user types, set Mask value. To perform input validation only after editing is completed, set Normal value. Mask editing of DateTimePickerBase will be supported only for System.Globalization.GregorianCalendar.
Header
Gets or sets the content for the control's header.
Declaration
public object Header { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Object | The default value is |
Examples
Set string as Header.
<!-- String header -->
<editor:SfDatePicker Header = "Date of birth" />
Set a control as Header.
<!-- TextBlock as header -->
<editor:SfTimePicker>
<editor:SfTimePicker.Header>
<TextBlock Text = "Start time" FontWeight="Bold"/>
</editor:SfTimePicker.Header>
</editor:SfTimePicker>
Apply a DataTemplate as Header.
<!-- Templated header -->
<calendar:SfCalendarDatePicker Header = "Date of birth">
<calendar:SfCalendarDatePicker.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontWeight="Bold"/>
</DataTemplate>
</calendar:SfCalendarDatePicker.HeaderTemplate>
</calendar:SfCalendarDatePicker>
HeaderTemplate
Gets or sets the DataTemplate used to display the content of the control's header.
Declaration
public DataTemplate HeaderTemplate { get; set; }
Property Value
| Type | Description |
|---|---|
| Microsoft.UI.Xaml.DataTemplate | The default value is |
Examples
Set string as Header.
<!-- String header -->
<calendar:SfCalendarDatePicker Header = "Date of birth" />
Set a control as Header.
<!-- TextBlock as header -->
<editor:SfDatePicker>
<editor:SfDatePicker.Header>
<TextBlock Text = "Date of birth" FontWeight="Bold"/>
</editor:SfDatePicker.Header>
</editor:SfDatePicker>
Apply a DataTemplate as Header.
<!-- Templated header -->
<editor:SfTimePicker Header = "Start time">
<editor:SfTimePicker.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontWeight="Bold"/>
</DataTemplate>
</editor:SfTimePicker.HeaderTemplate>
</editor:SfTimePicker>
ShowClearButton
Gets or sets a value indicating whether to show or hide the clear button in date and time editors.
Declaration
public bool ShowClearButton { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | The default value is true. |
Remarks
The ShowClearButton property will not have any effect when EditMode is None.
Methods
AttachFlyout()
Helps to attach the DropDownFlyout to DateTimePickerBase.
Declaration
protected virtual void AttachFlyout()
OnApplyTemplate()
Declaration
protected override void OnApplyTemplate()
Overrides
OnGotFocus(RoutedEventArgs)
Declaration
protected override void OnGotFocus(RoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.UI.Xaml.RoutedEventArgs | e |
OnKeyDown(KeyRoutedEventArgs)
Declaration
protected override void OnKeyDown(KeyRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.UI.Xaml.Input.KeyRoutedEventArgs | e |
Overrides
OnKeyUp(KeyRoutedEventArgs)
Declaration
protected override void OnKeyUp(KeyRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.UI.Xaml.Input.KeyRoutedEventArgs | e |
Overrides
OnPointerEntered(PointerRoutedEventArgs)
Declaration
protected override void OnPointerEntered(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e |
OnPointerExited(PointerRoutedEventArgs)
Declaration
protected override void OnPointerExited(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e |
OnPointerPressed(PointerRoutedEventArgs)
Declaration
protected override void OnPointerPressed(PointerRoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e |
UpdateValues()
Helps to update Syncfusion.UI.Xaml.Editors.DateTimeHandler properties value.
Declaration
protected virtual void UpdateValues()