While using the default validation handling in Silverlight ( using ValidatesOnExceptions=True,NotifyOnValidationError=True),
you typically get the exception message towards the side the textbox.
I would like the change the location of the validation message (exception message) and put it on the top of textbox. Any ideas on how I can do it. I could not find any literature on changing the error message location on the net.
This is (IMO) a sad oversight in the default validation UI. There should be a way for you to specify the ToolTip placement value, instead the placement value is fixed in the template to be “Right”.
Hence to change this you need to visit this MSDN topic Textbox Styles and Templates, make a copy of the
TextBoxdefault style and the referenced “ValidationToolTipTemplate”. Add these to a freshResourceDictionaryfile and give theTextBoxStylea Key value. You can now adjust the validation tooltipPlacementproperty in the text box template.Include this new
ResourceDictionaryas merged dictionary in either your App.Xaml or your UserControl/Page resources and assign this style to yourTextBoxStyleproperty.Excessive mucking about for just a simple change but there is no other way. On the upside you can do all sorts of other things with the text box style and/or the Validation tooltip now that you have them in your own code.