Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight: How to style the validation tooltip?

I did some searching but it wasn't what I was looking for. So, does anyone know a way how to style the validation tooltip in Silverlight(the thing in the green border)?

alt text http://img689.imageshack.us/img689/222/validationtooltip.png

Any help would be greatly appreciated!

Best Regards,

~K

like image 919
Kiril Stanoev Avatar asked Dec 14 '09 07:12

Kiril Stanoev


1 Answers

Unfortunately you can't easily provide a style for the validation tooltip without effectively styling the entire Textbox control. Blend makes this fairly easy if you are familiar with using that design tool. However if your a dyed in the wool coder like me then...

  • Goto this page on MSDN TextBox Styles and Templates
  • Copy the vsm namespace alias to your UserControl xaml
  • Copy the TextBox style into UserControls.Resources give it at an x:Key name (say MyTextBoxStyle")
  • Copy the ValidationToolTipTemplate from the web page to the UserControls.Resources, paste it above the TextBox style. It already has an x:Key name that the TextBox style will be referencing.
  • Add Style="{StaticResource MyTextBoxStyle}" to your TextBox in the data grid.

Now you play around with the validation elements of the templates to get your desired result.

like image 50
AnthonyWJones Avatar answered Sep 20 '22 12:09

AnthonyWJones