开发者

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


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.


The validation messages are displayed as a visual state. you can get to these (and edit them) as templates directly from blend.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜