【问题标题】:Tooltip is not visible on the disabled checkbox wpf工具提示在禁用的复选框 wpf 上不可见
【发布时间】:2015-11-21 13:09:28
【问题描述】:

即使在设置 ToolTipService.ShowOnDisabled="True" 之后,禁用复选框上的工具提示也不可见。

<CheckBox Grid.Column="0" HorizontalAlignment="Center" Visibility="{Binding Converter={StaticResource TaskCompletionVisbilityConverter},ConverterParameter='chkbox'}" 
                             Height="16" Width="16" Foreground="{Binding Converter={StaticResource TaskColorConverter}}"
                               ToolTipService.ShowOnDisabled="True" ToolTipService.IsEnabled="True"
                              ToolTip="Check To complete Task"
                               IsEnabled="{Binding State, Converter={StaticResource EnableDisableConverter},
                        ConverterParameter='checkbox',Mode=TwoWay}" Margin="37,5,0,0">

【问题讨论】:

  • WPF Tooltip Visibility的可能重复
  • 我不认为这个问题与WPF Tooltip Visibility 重复。事实上@Pa1 已经使用了ToolTipService.ShowOnDisabled="True"ToolTipService.IsEnabled="True"。我想工具提示应该是可见的,所以也许还有其他东西隐藏了它。 Pa1,您能否提供有关您的 XAML 的更多详细信息?

标签: wpf checkbox tooltip


【解决方案1】:

您的代码对我有用。 ToolTipService.ShowOnDisabled="True" 应该是你需要的。

请检查您没有在与复选框关联的任何样式/ControlTemplate 中将IsHitTestVisible 设置为false

IsHitTestVisible 设置为false 意味着它将忽略与控件关联的任何鼠标事件,因此您不会获得工具提示。

【讨论】:

  • 我从我的风格中删除了所有 IsHitTestVisible 引用,但仍然没有得到
  • 所以当复选框被启用时工具提示会显示,但是当它被禁用时它不会显示?尝试收听MouseOver 事件以检查当复选框被禁用时它是否仍然被触发?
【解决方案2】:

ToolTipService.ShowOnDisabled="True" 不适合我。以下作品:

<DataGridCheckBoxColumn.CellStyle>
    <Style>                                     
        <Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
    </Style>                                 
</DataGridCheckBoxColumn.CellStyle>

【讨论】:

    猜你喜欢
    • 2011-03-10
    • 1970-01-01
    • 2021-04-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多