Silverlight:如何设置验证工具提示的样式? [英] Silverlight: How to style the validation tooltip?

查看:22
本文介绍了Silverlight:如何设置验证工具提示的样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行了一些搜索,但这不是我想要的.那么,有没有人知道如何在 Silverlight 中设置验证工具提示的样式(绿色边框中的东西)?

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)?

替代文字 http://img689.imageshack.us/img689/222/validationtooltip.png

任何帮助将不胜感激!

此致,

~K

推荐答案

很遗憾,如果不有效地设置整个 Textbox 控件的样式,就无法轻松地为验证工具提示提供样式.如果您熟悉使用该设计工具,Blend 会使这变得相当容易.但是,如果您像我一样染上了羊毛编码器,那么...

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.

这篇关于Silverlight:如何设置验证工具提示的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆