--- title: "How to: Position a ToolTip" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "ToolTip control [WPF], positioning" - "positioning ToolTip controls [WPF]" ms.assetid: cddf3757-9e5f-4ce3-a6eb-44489cf3804a --- # How to: Position a ToolTip This example shows how to specify the position of a tooltip on the screen. ## Example You can position a tooltip by using a set of five properties that are defined in both the and classes. The following table shows these two sets of five properties and provides links to their reference documentation according to class. ### Corresponding tooltip properties according to class | class properties| class properties| |--------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| ||| ||| ||| ||| ||| If you define the contents of a tooltip by using a object, you can use the properties of either class; however, the properties take precedence. Use the properties for tooltips that are not defined as objects. The following illustrations show how to position a tooltip by using these properties. Although, the [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] examples in these illustrations show how to set the properties that are defined by the class, the corresponding properties of the class follow the same layout rules. For more information about the possible values for the Placement property, see [Popup Placement Behavior](popup-placement-behavior.md). The following image shows tooltip placement by using the Placement property: ![Diagram showing ToolTip placement by using the Placement property.](./media/how-to-position-a-tooltip/tooltip-placement-property.png) The following image shows tooltip placement by using the Placement and PlacementRectangle properties: ![Diagram showing ToolTip placement by using a PlacementRectangle property.](./media/how-to-position-a-tooltip/tooltip-placement-rectangle-property.png) The following image shows tooltip placement by using the Placement, PlacementRectangle, and Offset properties: ![Diagram showing ToolTip placement by using the Offset property.](./media/how-to-position-a-tooltip/tooltip-placement-offset-property.png) The following example shows how to use the properties to specify the position of a tooltip whose content is a object. [!code-xaml[ToolTipService#ToolTip](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolTipService/CSharp/Pane1.xaml#tooltip)] [!code-csharp[ToolTipService#ToolTipCode](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolTipService/CSharp/Pane1.xaml.cs#tooltipcode)] [!code-vb[ToolTipService#ToolTipCode](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ToolTipService/visualbasic/pane1.xaml.vb#tooltipcode)] The following example shows how to use the properties to specify the position of a tooltip whose content is not a object. [!code-xaml[ToolTipService#NoToolTip](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolTipService/CSharp/Pane1.xaml#notooltip)] [!code-csharp[ToolTipService#NoToolTipCode](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolTipService/CSharp/Pane1.xaml.cs#notooltipcode)] [!code-vb[ToolTipService#NoToolTipCode](~/samples/snippets/visualbasic/VS_Snippets_Wpf/ToolTipService/visualbasic/pane1.xaml.vb#notooltipcode)] ## See also - - - [How-to Topics](tooltip-how-to-topics.md) - [ToolTip Overview](tooltip-overview.md)