• Silverlight的Tooltip当控件Disable时不显示的问题


    在WPF中有ToolTipService.ShowOnDisabled="True"这样的附加属性可以完成这个实现
    可是在下面两篇提问中可以发现silverlight中缺乏这样的实现
    http://silverlight.net/forums/t/52753.aspx
    https://silverlight.net/forums/p/119934/270379.aspx
    但是这个对用户体验又是极其重要的,codeplex上有个扩展tooltipservice的项目,可是也并未涉及到这个问题
    http://tooltipservice.codeplex.com/

    例如 xaml
    Code

    code-behind
    Code

    这样当点击了按钮时是不会再显示tooltip了

    有一种不怎么有美感的解决方式就是,在要显示tooltip的控件上加一个透明的rectangle,然后在这个rectangle上放置原来要在控件上放的tooltip
    这样确实可以显示了
                    <Grid>
                        
    <Grid.ColumnDefinitions>
                            
    <ColumnDefinition Width="*"></ColumnDefinition>
                        
    </Grid.ColumnDefinitions>
                        
    <Grid.RowDefinitions>
                            
    <RowDefinition Height="*"></RowDefinition>
                        
    </Grid.RowDefinitions>
                        
    <Button Grid.Row="0" Grid.Column="0" x:Name="testButton" Content="test" IsEnabled="False" >
                        
                        
    </Button>
                        
    <Rectangle Fill="Transparent" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ToolTipService.ToolTip="test">
                            
                        
    </Rectangle>
                    
    </Grid>
    还有没有什么更好的解决方案呢?

  • 相关阅读:
    day22-20180522笔记
    day20-20180517笔记
    day19-20180515笔记
    day18-20180513笔记
    day17-20180510笔记
    day16-20180508笔记
    Python之初识面向对象
    Python之常用模块(2)
    Python之常用模块(1)
    Python之模块与包(下)
  • 原文地址:https://www.cnblogs.com/ueqtxu/p/1554292.html
Copyright © 2020-2023  润新知