#880 – Adding an Offset When Positioning a Popup

When you position a Popup control, you can add horizontal or vertical offsets to move the Popup away from its target position.

The popup’s HorizontalOffset property indicates how far to move the popup left or right.  A positive value will move the popup to the right and a negative value will move it to the left.

The popup’s VerticalOffset property indicates how far to move the popup up or down.  A positive value will move the popu down and a negative value will move it up.

In the example below, the Popup is placed relative to the bottom of a Button.  It’s then moved 10 units to the right and 5 units down.

        <Popup Name="popCaesar" StaysOpen="False"
               PlacementTarget="{Binding ElementName=btnLearn}"
               Placement="Bottom"
               HorizontalOffset="10" VerticalOffset="5">
            <Border BorderBrush="DarkBlue" BorderThickness="1"
                    Background="AntiqueWhite">
                <TextBlock Text="The seething sea ceaseth and thus the seething sea sufficeth us."
                            Padding="5" Width="160"
                            TextWrapping="Wrap"/>
            </Border>
        </Popup>

880-001

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

One Response to #880 – Adding an Offset When Positioning a Popup

  1. Pingback: Dew Drop – August 11-12, 2013 (#1,601) | Alvin Ashcraft's Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: