CustomPopupPlacement Structure
Defines custom placement parameters for a Popup control.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
The CustomPopupPlacement type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | CustomPopupPlacement | Initializes a new instance of the CustomPopupPlacement structure. |
| Name | Description | |
|---|---|---|
![]() | Equals | Compares this structure with another CustomPopupPlacement structure to determine whether they are equal. (Overrides ValueType::Equals(Object).) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Gets the hash code for this structure. (Overrides ValueType::GetHashCode().) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType.) |
| Name | Description | |
|---|---|---|
![]() ![]() | Equality | Compares two CustomPopupPlacement structures to determine whether they are equal. |
![]() ![]() | Inequality | Compares two CustomPopupPlacement structures to determine whether they are not equal. |
The CustomPopupPlacement structure defines a location for a Popup control with respect to its parent, and defines how the Popup moves to become more visible when it is obscured by a screen boundary.
A System.Windows.Controls.Primitives::CustomPopupPlacementCallback delegate returns an array of these structures as custom placement options for a Popup when the Placement property is set to Custom.
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>
For the complete sample, see Popup Placement Sample.
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.
