ToolTip for Disabled Element in Silverlight

ToolTip for Disabled Element in Silverlight,第1张

概述I noticed that there are many conversations departing in Silverlight forums regarding tool tip support for disabled elements in Silverlight. Silverlight program manager also accepts here that having t

I noticed that there are many conversations departing in Silverlight forums regarding tool tip support for Disabled elements in Silverlight. Silverlight program manager also accepts here that having the tooltip not show on a Disabled element is by design. However some folks suggesting mouse enter and mouse leave,and some evoking style modification,etc... But these approaches are not applicable when you develop your Silverlight application in MVVM pattern. Here is the simple approach that helps you to set tooltip for Disabled item.

Host a rectangle on top of your element in a grID and bind the visibility property of the Rectangle with IsEnabled property of target element (Make sure that you have BooleanToVisibilityConverter like the one in WPF). And bind your business property with tooltip of the rectangle as well as for your target element if you want to display in enabled state also. And also don’t forget to bind Rectangle WIDth and Height property with ActualWIDth and ActualHeight of button.

Here is the code.

@H_502_64@

 Collapse
<GrID margin="30,20,0">
<button x:name="Mybutton" Content="See My tooltip when I am in Disabled" IsEnabled="{Binding Path=IsEnabled}"/>
<Rectangle x:name="tooltipForDiabledbutton" Visibility="{Binding Path=IsEnabled,Elementname=Addbutton,Converter={StaticResource BoolToVisibilityConverter}}" tooltipService.tooltip="{Binding Path=Mytooltip,Mode=TwoWay}" Fill="transparent"
WIDth="{Binding Path=ActualWIDth,Elementname=Addbutton}" Height="{Binding Path=ActualHeight,Elementname=Addbutton}">
</Rectangle>
</GrID>

Hope this helps the MVVM folks.

总结

以上是内存溢出为你收集整理的ToolTip for Disabled Element in Silverlight全部内容,希望文章能够帮你解决ToolTip for Disabled Element in Silverlight所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1074765.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存