Share via


ToolTipService.SetPlacementTarget(DependencyObject, UIElement) 方法

定義

設定指定之目標專案的 ToolTipService.PlacementTarget XAML 附加屬性值。

public:
 static void SetPlacementTarget(DependencyObject ^ element, UIElement ^ value);
 static void SetPlacementTarget(DependencyObject const& element, UIElement const& value);
public static void SetPlacementTarget(DependencyObject element, UIElement value);
function setPlacementTarget(element, value)
Public Shared Sub SetPlacementTarget (element As DependencyObject, value As UIElement)

參數

element
DependencyObject

附加屬性值的目標專案。

value
UIElement

應為工具提示放置目標的視覺專案。

備註

這個方法支援 Extensible Application Markup Language (XAML) 的工具 提示Service.PlacementTarget 附加屬性使用方式。 元素的值不一定是 ToolTip,它可能是透過使用 ToolTipService API 擁有推斷工具提示的專案。 您可以使用 ToolTipService.PlacementTarget 附加屬性,將放置目標設定為與擁有 工具提示 的專案不同,以用於 UI 行為和內建 PointerEntered / PointerExited 處理。 這可讓控件就像工具提示顯示的單位一樣,讓某個控件的工具提示在顯示時不會遮蔽相關控件的重要部分。

適用於

另請參閱