Expand Minimize

PopupPrimaryAxis Enumeration

Describes the direction to move a Popup control to increase the amount of the Popup that is visible.

Namespace:  System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)

'Declaration
Public Enumeration PopupPrimaryAxis
<object property="enumerationMemberName" .../>

Member nameDescription
NoneA Popup control changes position according to default Popup behavior.
HorizontalA Popup control changes position by moving along the horizontal axis of the screen before moving along the vertical axis.
VerticalA Popup control changes position by moving along the vertical axis of the screen before moving along the horizontal axis.

This enumeration is a return value type for a CustomPopupPlacementCallback delegate that is used to define custom placement for a Popup.

This example shows how to specify a custom position for a Popup control when the Placement property is set to Custom.

When the Placement property is set to Custom, the Popup calls a defined instance of the CustomPopupPlacementCallback delegate. This delegate returns a set of possible points that are relative to the top left corner of the target area and the top left corner of the Popup. The Popup placement occurs at the point that provides the best visibility.

The following example shows how to define the position of a Popup by setting the Placement property to Custom. It also shows how to create and assign a CustomPopupPlacementCallback delegate in order to position the Popup. The callback delegate returns two CustomPopupPlacement objects. If the Popup is hidden by a screen edge at the first position, the Popup is placed at the second position.


 <Popup Name="popup1"  
        PlacementTarget ="{Binding ElementName=myButton}" 
        Placement="Custom">
  <TextBlock Height="60" Width="200" 
             Background="LightGray"
             TextWrapping="Wrap">Popup positioned by using
  CustomPopupPlacement callback delegate</TextBlock>
</Popup>



		Public Function placePopup(ByVal popupSize As Size, ByVal targetSize As Size, ByVal offset As Point) As CustomPopupPlacement()
			Dim placement1 As New CustomPopupPlacement(New Point(-50, 100), PopupPrimaryAxis.Vertical)

			Dim placement2 As New CustomPopupPlacement(New Point(10, 20), PopupPrimaryAxis.Horizontal)

			Dim ttplaces() As CustomPopupPlacement = { placement1, placement2 }
			Return ttplaces
		End Function



			popup1.CustomPopupPlacementCallback = New CustomPopupPlacementCallback(AddressOf placePopup)


For the complete sample, see Popup Placement Sample.

.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.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft