ToolTip.Placement 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public:
property PlacementMode Placement { PlacementMode get(); void set(PlacementMode value); };
PlacementMode Placement();
void Placement(PlacementMode value);
public PlacementMode Placement { get; set; }
var placementMode = toolTip.placement;
toolTip.placement = placementMode;
Public Property Placement As PlacementMode
<ToolTip Placement="placementModeMemberName"/>
屬性值
其中一個 PlacementMode 的值。
範例
以下程式碼範例展示了工具 提示的放置模式。
<StackPanel Margin="120" >
<TextBlock Text="ToolTip Control"/>
<TextBlock Text="Hover over an item to see its ToolTip: " Margin="0,10"/>
<ListBox Width="100" HorizontalAlignment="Left">
<ListBoxItem Content="Left"
ToolTipService.ToolTip="ToolTip to the left."
ToolTipService.Placement="Left" />
<ListBoxItem Content="Right"
ToolTipService.ToolTip="ToolTip to the right."
ToolTipService.Placement="Right" />
<ListBoxItem Content="Top"
ToolTipService.ToolTip="ToolTip at the top."
ToolTipService.Placement="Top" />
<ListBoxItem Content="Bottom"
ToolTipService.ToolTip="ToolTip at the bottom."
ToolTipService.Placement="Bottom"/>
<ListBoxItem Content="Mouse"
ToolTipService.ToolTip="ToolTip based on the cursor position."
ToolTipService.Placement="Mouse"/>
</ListBox>
</StackPanel>
備註
若無明確的 PlacementTarget,則工具 提示 的放置目標即為指定該 提示 為其 ToolTipService.Tooltip 附加屬性值的元素,任何 Placement 值皆適用於該目標。
放置和 放置 目標通常會作為預設。 指定這兩個屬性之一或兩種屬性的情況是,當你想避免提示顯示時,提示會遮蔽它所指的內容。