始终显示 WPF 文本框工具提示 [英] Always show WPF TextBox Tooltip

查看:35
本文介绍了始终显示 WPF 文本框工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以一直显示tooltip,不依赖于控件是否获得焦点,而只依赖于bind属性的值.

Is it possible to display tooltip constantly, not depending on whether the control is focused ot not, but depending only on the value of the bind property.

<TextBox Name="projectTextBox" 
         ToolTipService.Placement="Bottom" ToolTipService.ShowDuration="12000" 
         MinWidth="150" Text="{Binding ProjectName}" IsEnabled="{Binding IsEnabled}">
    <TextBox.ToolTip>
        <ToolTip Placement="Bottom" 
                 StaysOpen="True" Content="TEXT" 
                 Visibility="{Binding IsNotFound, Converter={StaticResource booleanToVisibilityCollapsedConverter}}" 
                 IsOpen="True">
        </ToolTip>
    </TextBox.ToolTip>
</TextBox>

推荐答案

你应该为你正在寻找的行为使用装饰器.您可以根据需要使用数据触发器或您想要显示的装饰器.顺便说一句,在移动主窗口时,使用装饰器不会出现弹出窗口的问题.

you should use an adorner for the behavior you are looking for. you can use a datatrigger or what you want to show the adorner as long as you want. btw with an adorner you did not have the problems popups have, while moving the mainwindow.

这篇关于始终显示 WPF 文本框工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆