PlacementRectangle Property

ToolTip.PlacementRectangle Property

Gets or sets the rectangular area relative to which the ToolTip control is positioned when it opens.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

'Declaration
<BindableAttribute(True)> _
Public Property PlacementRectangle As Rect
<object>
  <object.PlacementRectangle>
    <Rect .../>
  </object.PlacementRectangle>
</object>
<object PlacementRectangle="Rect" .../>

Property Value

Type: System.Windows.Rect
The Rect structure that defines the rectangle that is used to position the ToolTip control. The default is Empty.

Identifier field

PlacementRectangleProperty

Metadata properties set to true

None

You can position ToolTip by setting the PlacementTarget, PlacementRectangle, Placement, HorizontalOffset, and VerticalOffsetProperty properties. These properties behave the same as they do for a Popup. For more information, see Popup Placement Behavior.

The following example shows how to create and position a ToolTip.


      <Ellipse Height="25" Width="50" 
               Fill="Gray" 
               HorizontalAlignment="Left"
               ToolTipService.InitialShowDelay="1000"
               ToolTipService.ShowDuration="7000"
               ToolTipService.BetweenShowDelay="2000">
        <Ellipse.ToolTip>
          <ToolTip Placement="Right" 
                   PlacementRectangle="50,0,0,0"
                   HorizontalOffset="10" 
                   VerticalOffset="20"
                   HasDropShadow="false"
                   Opened="whenToolTipOpens"
                   Closed="whenToolTipCloses"
                   >
            <BulletDecorator>
              <BulletDecorator.Bullet>
                <Ellipse Height="10" Width="20" Fill="Blue"/>
              </BulletDecorator.Bullet>
              <TextBlock>Uses the ToolTip Class</TextBlock>
            </BulletDecorator>
          </ToolTip>
        </Ellipse.ToolTip>
      </Ellipse>




			'Create an ellipse that will have a 
			'ToolTip control. 
			Dim ellipse1 As New Ellipse()
			ellipse1.Height = 25
			ellipse1.Width = 50
			ellipse1.Fill = Brushes.Gray
			ellipse1.HorizontalAlignment = HorizontalAlignment.Left

			'Create a tooltip and set its position.
			Dim tooltip As New ToolTip()
			tooltip.Placement = PlacementMode.Right
			tooltip.PlacementRectangle = New Rect(50, 0, 0, 0)
			tooltip.HorizontalOffset = 10
			tooltip.VerticalOffset = 20

			'Create BulletDecorator and set it
			'as the tooltip content.
			Dim bdec As New BulletDecorator()
			Dim littleEllipse As New Ellipse()
			littleEllipse.Height = 10
			littleEllipse.Width = 20
			littleEllipse.Fill = Brushes.Blue
			bdec.Bullet = littleEllipse
			Dim tipText As New TextBlock()
			tipText.Text = "Uses the ToolTip class"
			bdec.Child = tipText
			tooltip.Content = bdec

			'set tooltip on ellipse
			ellipse1.ToolTip = tooltip


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2016 Microsoft