开发者

Missing Hover effect on binded hyperlink button

I have several hyperlink buttons on my Silverlight 4 application. When i bind content property of hyperlink to my VM class, hover effect (underline and bold) doesn't show! When I remove binding and type text manually, hover effect is visible.

Why I don't see hover effect on Hyperlink button when I bind Content property to VM obje开发者_JS百科ct?


It's because, if I remember well, the hovering effect is achieved using a TextBlock element in the hyperlink control template. When you hover over the hyperlink, this textblock is shown, otherwise not.

The Text property of the TextBlock is bound to the same source as the content property of the Hyperlink. But whereas the content property is of object type, the Text property of the TextBlock is of type string.

Then if you bind the hyperlink content to something which is not a Text, the Textblock binding will fail, and the hovering effect won't be enabled. To correct the issue, bind the Hyperlink's conten property to a string, or use a BindingConverter to output a string from your non string object.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜