ToolTipService.SetPlacementTarget(DependencyObject, UIElement) ToolTipService.SetPlacementTarget(DependencyObject, UIElement) ToolTipService.SetPlacementTarget(DependencyObject, UIElement) ToolTipService.SetPlacementTarget(DependencyObject, UIElement) Method

定義

オブジェクトに対する PlacementTarget 添付プロパティの値を設定します。Sets the value of the PlacementTarget attached property for an object.

public:
 static void SetPlacementTarget(System::Windows::DependencyObject ^ element, System::Windows::UIElement ^ value);
public static void SetPlacementTarget (System.Windows.DependencyObject element, System.Windows.UIElement value);
static member SetPlacementTarget : System.Windows.DependencyObject * System.Windows.UIElement -> unit
Public Shared Sub SetPlacementTarget (element As DependencyObject, value As UIElement)

パラメーター

element
DependencyObject DependencyObject DependencyObject DependencyObject

添付プロパティの書き込み対象のオブジェクト。The object to which the attached property is written.

value
UIElement UIElement UIElement UIElement

設定する値。The value to set.

ToolTipService.PlacementTarget添付プロパティの値を設定する方法を次の例に示します。The following example shows how to set the value for the ToolTipService.PlacementTarget attached property.

//create the button that displays the tooltip
Button targetButton = new Button();
targetButton.Content = "tooltip Placement Target";

//create a button that owns the tooltip
Button tooltipOwner = new Button();
tooltipOwner.Content = "tooltip owner";
tooltipOwner.ToolTip = "The ToolTip";
ToolTipService.SetPlacement(tooltipOwner,PlacementMode.Top);
ToolTipService.SetPlacementTarget(tooltipOwner,targetButton);
'create the button that displays the tooltip
Dim targetButton As New Button()
targetButton.Content = "tooltip Placement Target"

'create a button that owns the tooltip
Dim tooltipOwner As New Button()
tooltipOwner.Content = "tooltip owner"
tooltipOwner.ToolTip = "The ToolTip"
ToolTipService.SetPlacement(tooltipOwner,PlacementMode.Top)
ToolTipService.SetPlacementTarget(tooltipOwner,targetButton)

適用対象

こちらもご覧ください