Export (0) Print
Expand All

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)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public enum PopupPrimaryAxis
public enum PopupPrimaryAxis
public enum PopupPrimaryAxis
<object property="EnumerationValue" .../>

 Member nameDescription
HorizontalA Popup control changes position by moving along the horizontal axis of the screen before moving along the vertical axis.  
NoneA Popup control changes position according to default Popup behavior.  
VerticalA Popup control changes position by moving it 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 PlacementRectangle, VerticalOffset, and HorizontalOffset properties have no effect. Instead, the Popup calls a defined instance of the CustomPopupPlacementCallback delegate. This delegate returns a set of possible points that are relative to the target element where you want the Popup to appear. 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.

 <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 CustomPopupPlacement[] placePopup(Size popupSize,
                                           Size targetSize,
                                           Point offset)
{
    CustomPopupPlacement placement1 =
       new CustomPopupPlacement(new Point(-50, 100), PopupPrimaryAxis.Vertical);

    CustomPopupPlacement placement2 =
        new CustomPopupPlacement(new Point(10, 20), PopupPrimaryAxis.Horizontal);

    CustomPopupPlacement[] ttplaces =
            new CustomPopupPlacement[] { placement1, placement2 };
    return ttplaces;
}

popup1.CustomPopupPlacementCallback =
    new CustomPopupPlacementCallback(placePopup);

For the complete sample, see Custom Popup Placement Sample.

More Code

How to: Position a Popup

This set of examples shows how to use the placement properties to specify the position of a Popup control.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft