RadControls for Windows Phone Q2 2012 came with a few new controls and one of them is RadTextBox. This is an extended TextBox which provides:

Header

Watermark

Validation

ActionButton

ClearButton

The control inherits from the native TextBox so it is easy to port into existing projects.

The Clear and Action Buttons’ visibility can be controlled with the properties ClearButtonVisibility and ActionButtonVisibility respectively. The clear button’s function is to clear all the current input in the text box. It is visible only when there is some input because if the field is empty, such a button is not of much use. The ActionButton doesn’t have a predefined action. You have absolute freedom to decide what happens after the button is pressed by using the ActionButtonTap event or the ActionButtonCommand.

The watermark is the text that is displayed in the text box when there is no input and its purpose is to give a hint about what should be the text that is expected to be entered. The header is of type object, so it can contain not only text but images, shapes and even other controls. When the user taps on the header the focus goes to the text field.



And last but not least important is the validation feature. The control itself doesn’t have any validation logic but it provides a method ChangeValidationState which allows you to choose the state the control is in – NotValidated (the initial state), Validating (you can use it if your validation logic requires noticeable amount of time), Valid and Invalid. The method also allows you to provide a ValidationMessage that will be displayed above the text box.



Don’t hesitate to share your comments with us here or in our forums. If you still haven't downloaded our Q2 2012 release, you can get a free trial now.