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所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)