如何使用ToolTipService.Duration使WPF工具提示更快出现?

时间:2009-12-03 18:36:04

标签: c# wpf xaml tooltip

如何更快地在以下代码中显示工具提示?

using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace TestHover29282
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            TextBlock tb = new TextBlock();
            tb.Text = "Jim Smith";

            ToolTip tt = new ToolTip();
            tt.Content = "This is some info on the customer.";

            tb.ToolTip = tt;

            //ToolTipService tts = new ToolTipService();
            //tts.Duration = 0;
            //tb.ToolTipService = tts;

            MainStackPanel.Children.Add(tb); 
        }
    }
}

1 个答案:

答案 0 :(得分:10)

ToolTipService.SetInitialShowDelay(tb, 10);