Telerik blogs

You’ve talked and we’ve listened: as of Beta 2 release of RadControls for Windows Phone 7 the RadTimePicker and RadDatePicker controls support null-value. In other words, you will be able to set the current value to null and display a custom message to your users informing them that there is no value selected in the control at the time:

this.radTimePicker1.Value = null;
this.radTimePicker1.EmptyContent = "Select time";

 

There are also two additional properties which are used in this context:

EmptyContent – defining the content that will be displayed to the user when there is no value selected in the control

EmptyContentTemplate – defining how the empty content will be displayed to the user

The EmptyContent property is of type object and in the simplest scenario can be set to a string that the end user will see when the Value property of the RadDate- or RadTimePicker control is set to null. You can also implement a more complex scenario by setting any type of business objects to this property and also defining EmptyContentTemplate. The EmptyContentTemplate property is of type DataTemplate and defines how the information from the EmptyContent object will be presented. So, basically, you are able to define any type of rich content that will be displayed to the end user when the value of the RadTime- or RadDatePicker is set to null.

A RadTimePicker with custom EmptyContentTemplate

It is important noting that these new features imply some breaking changes in both the RadDate- and RadTimePicker controls. From now on, the Value property changes its type from DateTime to DateTime? (nullable DateTime). The ValueChanging and ValueChanged events are updated in this context as well. So, if you are using these controls and plan to check out our new Beta 2 release make sure to consider this.


Deyan Ginev
About the Author

Deyan Ginev

Deyan has been with Telerik for more than ​six years working on several different products with main focus on mobile technologies. Deyan is currently working on NativeScript– a platform for developing native mobile apps with JavaScript. Find him on Twitter via
@deyan_ginev.

Comments

Comments are disabled in preview mode.