New to Telerik UI for WPF? Download free 30-day trial

Preview ToolTip

The RadDateTimePicker control supports a preview tool tip. This feature helps you preview the inputted text while you are typing in the control's input box.

This tooltip acts like the autocomplete functionality. It is a suggestion tooltip, which tries to guess the input as you are typing it. The RadDateTimePicker also shows you a validation ErrorTooltip indicating that the input cannot be parsed as a valid DateTime.

By default, text input is enabled for the RadDateTimePicker, because you have the option to enter for instance "3 September" and the tooltip will update its value to suggest 9/3/2010.

Additionally, the ParseDateTimeValue event is raised on lost focus because text should be parsed after one has finished entering input and this is the intended default behavior. Read more here.

Concerning the preview tooltip the RadDateTimePicker gives you the following properties:

  • TooltipContent - represents the tooltip's actual content.

  • TooltipTemplate - it is of type DataTemplate and allows you to change the tooltip's default template.

  • ErrorTooltipContent - represents the content shown when no suggestion of the input can be made. Usually you will see this text when the input is not a valid DateTime object.

Here is an example of using these properties:

<telerik:RadDateTimePicker x:Name="radDateTimePicker" ErrorTooltipContent="Enter a valid date and time!"> 
    <telerik:RadDateTimePicker.TooltipTemplate> 
        <DataTemplate> 
            <TextBlock Text="{Binding Path=TooltipContent, ElementName=radDateTimePicker}" FontWeight="Bold" Foreground="Red"/> 
        </DataTemplate> 
    </telerik:RadDateTimePicker.TooltipTemplate> 
</telerik:RadDateTimePicker> 

Here is the result:

WPF RadDateTimePicker Error Tooltip Content and Template

When using the above described approach you should know that setting the x:Name of the RadDateTimePicker to either "DatePicker" or "DateTimePicker" will lead to the ErrorTooltip not showing. The reason is that those specific names are already used in the theme of the control which lead to the binding in the custom TooltipTemplate getting broken.

See Also

In this article