如何:使用 BetweenShowDelay 屬性
此範例示範如何使用 BetweenShowDelay 時間屬性,在使用者將滑鼠指標從某個工具提示直接移到另一個工具提示時,工具提示會快速出現,且幾乎沒有延遲。
範例
在下列範例中,InitialShowDelay 屬性會設定為一秒 (1000 毫秒),並將 BetweenShowDelay 設定為兩秒 (2000 毫秒),以取得這兩個 Ellipse 控制項的工具提示。 如果您顯示其中一個省略符號的工具提示,然後在兩秒內將滑鼠指標移至另一個省略符號並暫停,則第二個省略符號的工具提示會立即顯示。
在下列任一案例中,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>