Partager via


ToolTipService.SetPlacementTarget(DependencyObject, UIElement) Méthode

Définition

Définit la valeur de la propriété jointe PlacementTarget pour un objet.

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)

Paramètres

element
DependencyObject

Objet sur lequel la propriété jointe est écrite.

value
UIElement

Valeur à définir.

Exemples

L’exemple suivant montre comment définir la valeur de la ToolTipService.PlacementTarget propriété jointe.

   //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)

S’applique à

Voir aussi