【问题标题】:WPF - Tooltips are being clipped to window sizeWPF - 工具提示被裁剪为窗口大小
【发布时间】:2014-04-18 22:48:45
【问题描述】:

我已经看到 WPF 工具提示可以显示为未剪辑到它们正在查看的窗口中,但对我来说,它们正在剪辑到窗口中。

http://wpf.2000things.com/2013/07/17/865-tooltip-can-extend-beyond-window-boundaries/

我的结果:

<TextBlock Text="?" ToolTip="Denotes if initial dividend calculation will be rounded to nearest $0.01" />

任何想法为什么这会显示在窗口的边界内?我能找到的所有其他示例都有显示在窗口上方的工具提示

【问题讨论】:

    标签: wpf tooltip


    【解决方案1】:

    只是好奇..如果您将 AdornerDecorator 包裹在您的控件或整个视图周围会发生什么?

    <AdornerDecorator>
    
    </AdornerDecorator>
    

    【讨论】:

    • 这对我没有任何影响。我想出的最好的办法是将工具提示明确指定为带有换行的文本块,但它仍然仅限于窗口。
    【解决方案2】:

    很久以后,我找到了解决方案。应用以下样式将换行文本,并阻止工具提示被截断。

        <Style TargetType="ToolTip">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding}" TextWrapping="Wrap" />
                        </StackPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    

    【讨论】:

      猜你喜欢
      • 2011-08-20
      • 2016-01-10
      • 2016-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-18
      • 1970-01-01
      相关资源
      最近更新 更多