如何:使用 BetweenShowDelay 属性

更新:2010 年 7 月

此示例演示如何使用 BetweenShowDelay 时间属性,以便在用户将鼠标指针从一个工具提示直接移到另一个工具提示时,工具提示可以快速出现 — 只会稍有延迟或者不会延迟。

示例

在下面的示例中,对于两个 Ellipse 控件的工具提示,InitialShowDelay 属性都设置为一秒(1000 毫秒),并且 BetweenShowDelay 都设置为两秒(2000 毫秒)。 如果显示其中一个椭圆的工具提示,然后在两秒内将鼠标指针移至并停放在另一个椭圆上,则第二个椭圆的工具提示将立即显示。

在以下任一方案中,将应用 InitialShowDelay,这会导致第二个椭圆的工具提示要等待一秒才会出现:

  • 如果移到第二个按钮所花的时间长于两秒。

  • 如果工具提示在第一个椭圆的时间间隔开始时不可见。

      <Ellipse Height="25" Width="50" 
               Fill="Gray" 
               HorizontalAlignment="Left"
               ToolTipService.InitialShowDelay="1000"
               ToolTipService.ShowDuration="7000"
               ToolTipService.BetweenShowDelay="2000">
        <Ellipse.ToolTip>
          <ToolTip Placement="Right" 
                   PlacementRectangle="50,0,0,0"
                   HorizontalOffset="10" 
                   VerticalOffset="20"
                   HasDropShadow="false"
                   Opened="whenToolTipOpens"
                   Closed="whenToolTipCloses"
                   >
            <BulletDecorator>
              <BulletDecorator.Bullet>
                <Ellipse Height="10" Width="20" Fill="Blue"/>
              </BulletDecorator.Bullet>
              <TextBlock>Uses the ToolTip Class</TextBlock>
            </BulletDecorator>
          </ToolTip>
        </Ellipse.ToolTip>
      </Ellipse>



...


<Ellipse Height="25" Width="50" 
      Fill="Gray" 
      HorizontalAlignment="Left"
      ToolTipService.InitialShowDelay="1000"
      ToolTipService.ShowDuration="7000"
      ToolTipService.BetweenShowDelay="2000"
      ToolTipService.Placement="Right" 
      ToolTipService.PlacementRectangle="50,0,0,0"
      ToolTipService.HorizontalOffset="10" 
      ToolTipService.VerticalOffset="20"
      ToolTipService.HasDropShadow="false"
      ToolTipService.ShowOnDisabled="true" 
      ToolTipService.IsEnabled="true"
      ToolTipOpening="whenToolTipOpens"
      ToolTipClosing="whenToolTipCloses"
      >
  <Ellipse.ToolTip>
    <BulletDecorator>
      <BulletDecorator.Bullet>
        <Ellipse Height="10" Width="20" Fill="Blue"/>
      </BulletDecorator.Bullet>
      <TextBlock>Uses the ToolTipService class</TextBlock>
    </BulletDecorator>
  </Ellipse.ToolTip>
</Ellipse>

请参见

参考

ToolTip

ToolTipService

概念

ToolTip 概述

其他资源

ToolTip 帮助主题

修订记录

日期

修订记录

原因

2010 年 7 月

添加了缺少的代码。

客户反馈