MaskedDateTimeInput

The RadMaskedDateTimeInput represents the basic control that can be used to restrict the input of DateTime values.

In order to use the RadMaskedDateTimeInput control in your projects you have to add references to the following assemblies:

  • Telerik.Windows.Controls
  • Telerik.Windows.Controls.Input

You can find more info here.

Here is a simple definition of a RadMaskedDateTimeInput control:

Example 1: Define RadMaskedDateTimeInput in XAML

<telerik:RadMaskedDateTimeInput Width="200" 
                                Margin="20 20 20 10" 
                                Culture="en-US" 
                                EmptyContent="Enter digits" 
                                InputBehavior="Replace" 
                                Mask="dd-MM-yyyy" 
                                SelectionOnFocus="SelectAll" 
                                TextMode="PlainText" 
                                UpdateValueEvent="LostFocus" /> 

You can further restrict the user input by setting the FormatString property.

Example 2: Setting the FormatString property

<telerik:RadMaskedDateTimeInput HorizontalAlignment="Center" 
                                Culture="en-US" 
                                FormatString="{}Day: {0:dd}, Month: {0:MM}, Year: {0:yyyy}" 
                                InputBehavior="Replace" 
                                Mask="dd-MM-yyyy" 
                                SelectionOnFocus="SelectAll" 
                                TextMode="PlainText" 
                                UpdateValueEvent="LostFocus" /> 

Changing AM/PM

With the built-in functionality of the control it is not necessary to type AM or PM in order to change the time period. When the caret is on the time period you can simply press UP or DOWN arrow keys from AM to PM and vice verse. In order to display the time period simply add "t" or "tt" in the Mask property.

See Also

In this article
Not finding the help you need? Improve this article