Compartir a través de


ToolTipService.SetPlacementTarget(DependencyObject, UIElement) Método

Definición

Establece el valor de la propiedad adjunta PlacementTarget de un objeto.

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)

Parámetros

element
DependencyObject

Objeto en el que se escribe la propiedad adjunta.

value
UIElement

Valor que se va a establecer.

Ejemplos

En el ejemplo siguiente se muestra cómo establecer el valor de la ToolTipService.PlacementTarget propiedad adjunta.

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

Se aplica a

Consulte también