PlacementMode 枚举

定义

描述 Popup 控件在屏幕上显示的位置。Describes the placement of where a Popup control appears on the screen.

public enum class PlacementMode
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public enum PlacementMode
type PlacementMode = 
Public Enum PlacementMode
继承
PlacementMode
属性

字段

Absolute 0

Popup 控件的位置,该位置相对于屏幕的左上角,且在由 HorizontalOffsetVerticalOffset 的属性值定义的偏移量处。A position of the Popup control relative to the upper-left corner of the screen and at an offset that is defined by the HorizontalOffset and VerticalOffset property values. 如果屏幕边缘遮盖 Popup,则控件会重新定位自身以与边缘对齐。If the screen edge obscures the Popup, the control then repositions itself to align with the edge.

AbsolutePoint 5

Popup 控件的位置,该位置相对于屏幕的左上角,且在由 HorizontalOffsetVerticalOffset 的属性值定义的偏移量处。A position of the Popup control relative to the upper-left corner of the screen and at an offset that is defined by the HorizontalOffset and VerticalOffset property values. 如果屏幕边缘遮盖 Popup,则控件会从 HorizontalOffsetVerticalOffset= 所定义的轴的相反方向扩展。If the screen edge obscures the Popup, the control extends in the opposite direction from the axis defined by the HorizontalOffset or VerticalOffset=.

Bottom 2

Popup 控件的位置,即控件上边缘与 PlacementTarget 的下边缘对齐,控件左边缘与 PlacementTarget 的左边缘对齐。A position of the Popup control where the control aligns its upper edge with the lower edge of the PlacementTarget and aligns its left edge with the left edge of the PlacementTarget. 如果屏幕下边缘遮盖 Popup,则控件会重新定位自身,以便其下边缘与 PlacementTarget 的上边缘对齐。If the lower screen-edge obscures the Popup, the control repositions itself so that its lower edge aligns with the upper edge of the PlacementTarget. 如果屏幕上边缘遮盖 Popup,则控件会重新定位自身,以便其上边缘与屏幕上边缘对齐。If the upper screen-edge obscures the Popup, the control then repositions itself so that its upper edge aligns with the upper screen-edge.

Center 3

Popup 上居中的 PlacementTarget 控件的位置。A position of the Popup control where it is centered over the PlacementTarget. 如果屏幕边缘遮盖 Popup,则控件会重新定位自身以与屏幕边缘对齐。If a screen edge obscures the Popup, the control repositions itself to align with the screen edge.

Custom 11

Popup 控件的位置和重新定位行为,由 CustomPopupPlacementCallback 属性所指定的 CustomPopupPlacementCallback 委托定义。A position and repositioning behavior for the Popup control that is defined by the CustomPopupPlacementCallback delegate specified by the CustomPopupPlacementCallback property.

Left 9

Popup 控件,其右边缘与 PlacementTarget 的左边缘对齐,上边缘与 PlacementTarget 的上边缘对齐。A Popup control that aligns its right edge with the left edge of the PlacementTarget and aligns its upper edge with the upper edge of the PlacementTarget. 如果屏幕左边缘遮盖 Popup,则 Popup 会重新定位自身,以便其左边缘与 PlacementTarget 的右边缘对齐。If the left screen-edge obscures the Popup, the Popup repositions itself so that its left edge aligns with the right edge of the PlacementTarget. 如果屏幕右边缘遮盖 Popup,则控件的右边缘会与屏幕的右边缘对齐。If the right screen-edge obscures the Popup, the right edge of the control aligns with the right screen-edge. 如果屏幕上或下边缘遮盖 Popup,则控件会重新定位自身,使其与进行遮盖的屏幕边缘对齐。If the upper or lower screen-edge obscures the Popup, the control repositions itself to align with the obscuring screen edge.

Mouse 7

Popup 控件的位置,即控件上边缘与鼠标边界框的下边缘对齐,控件左边缘与鼠标边界框的左边缘对齐。A position of the Popup control that aligns its upper edge with the lower edge of the bounding box of the mouse and aligns its left edge with the left edge of the bounding box of the mouse. 如果屏幕下边缘遮盖 Popup,则控件会重新定位自身,使其与鼠标边界框的上边缘对齐。If the lower screen-edge obscures the Popup, it repositions itself to align with the upper edge of the bounding box of the mouse. 如果屏幕上边缘遮盖 Popup,则控件会重新定位自身,使其与屏幕上边缘对齐。If the upper screen-edge obscures the Popup, the control repositions itself to align with the upper screen-edge.

MousePoint 8

Popup 控件的位置,该位置相对于鼠标光标的顶端,且在由 HorizontalOffsetVerticalOffset 的属性值定义的偏移量处。A position of the Popup control relative to the tip of the mouse cursor and at an offset that is defined by the HorizontalOffset and VerticalOffset property values. 如果屏幕水平或垂直边缘遮盖 Popup,则它会从进行遮盖的边缘的相反方向打开。If a horizontal or vertical screen edge obscures the Popup, it opens in the opposite direction from the obscuring edge. 如果相反方向的屏幕边缘也遮盖 Popup,则它会与进行遮盖的屏幕边缘对齐。If the opposite screen edge also obscures the Popup, it then aligns with the obscuring screen edge.

Relative 1

Popup 控件的位置,该位置相对于 PlacementTarget 的左上角,且在由 HorizontalOffsetVerticalOffset 的属性值定义的偏移量处。A position of the Popup control relative to the upper-left corner of the PlacementTarget and at an offset that is defined by the HorizontalOffset and VerticalOffset property values. 如果屏幕边缘遮盖 Popup,则控件会重新定位自身以与屏幕边缘对齐。If the screen edge obscures the Popup, the control repositions itself to align with the screen edge.

RelativePoint 6

Popup 控件的位置,该位置相对于 PlacementTarget 的左上角,且在由 HorizontalOffsetVerticalOffset 的属性值定义的偏移量处。A position of the Popup control relative to the upper-left corner of the PlacementTarget and at an offset that is defined by the HorizontalOffset and VerticalOffset property values. 如果屏幕边缘遮盖 Popup,则 Popup 会从 HorizontalOffsetVerticalOffset 所定义的轴的相反方向扩展。If a screen edge obscures the Popup, the Popup extends in the opposite direction from the direction from the axis defined by the HorizontalOffset or VerticalOffset. 如果相反方向的屏幕边缘也遮盖 Popup,则控件会与此屏幕边缘对齐。If the opposite screen edge also obscures the Popup, the control then aligns with this screen edge.

Right 4

Popup 控件的位置,即控件的左边缘与 PlacementTarget 的右边缘对齐,控件上边缘与 PlacementTarget 的上边缘对齐。A position of the Popup control that aligns its left edge with the right edge of the PlacementTarget and aligns its upper edge with the upper edge of the PlacementTarget. 如果屏幕右边缘遮盖 Popup,则控件会重新定位自身,以便其左边缘与 PlacementTarget 的左边缘对齐。If the right screen-edge obscures the Popup, the control repositions itself so that its left edge aligns with the left edge of the PlacementTarget. 如果屏幕左边缘遮盖 Popup,则控件会重新定位自身,以便其左边缘与屏幕左边缘对齐。If the left screen-edge obscures the Popup, the control repositions itself so that its left edge aligns with the left screen-edge. 如果屏幕上或下边缘遮盖 Popup,则控件会重新定位自身,使其与进行遮盖的屏幕边缘对齐。If the upper or lower screen-edge obscures the Popup, the control then repositions itself to align with the obscuring screen edge.

Top 10

Popup 控件的位置,控件下边缘与 PlacementTarget 的上边缘对齐,左边缘与 PlacementTarget 的左边缘对齐。A position of the Popup control that aligns its lower edge with the upper edge of the PlacementTarget and aligns its left edge with the left edge of the PlacementTarget. 如果屏幕上边缘遮盖 Popup,则控件会重新定位自身,以便其上边缘与 PlacementTarget 的下边缘对齐。If the upper screen-edge obscures the Popup, the control repositions itself so that its upper edge aligns with the lower edge of the PlacementTarget. 如果屏幕下边缘遮盖 Popup,则控件的下边缘会与屏幕的下边缘对齐。If the lower screen-edge obscures the Popup, the lower edge of the control aligns with the lower screen-edge. 如果屏幕左或右边缘遮盖 Popup,则控件会重新定位自身,使其与进行遮盖的屏幕对齐。If the left or right screen-edge obscures the Popup, it then repositions itself to align with the obscuring screen.

示例

下面的示例创建了Popup四个相对于图像的控件。The following example creates four Popup controls that are relative to an image. 对于Popup "位置" 属性, 每个值都有不同的值。Each Popup has a different value for the placement property.

<Canvas Width="200" Height="150">
  <Image Name="image1"
         Canvas.Left="75" 
         Source="Water_lilies.jpg" Height="200" Width="200"/>
  <Popup IsOpen="True" PlacementTarget="{Binding ElementName=image1}"
         Placement="Bottom">
    <TextBlock FontSize="14" Background="LightGreen">Placement=Bottom</TextBlock>

  </Popup>
  <Popup IsOpen="True" PlacementTarget="{Binding ElementName=image1}"
         Placement="Top">
    <TextBlock FontSize="14" Background="LightGreen">Placement=Top</TextBlock>

  </Popup>
  <Popup IsOpen="True" PlacementTarget="{Binding ElementName=image1}"
         Placement="Left">
    <TextBlock FontSize="14" Background="LightGreen">Placement=Left</TextBlock>

  </Popup>
  <Popup IsOpen="True" PlacementTarget="{Binding ElementName=image1}"
         Placement="Right">
    <TextBlock FontSize="14" Background="LightGreen">Placement=Right</TextBlock>

  </Popup>
</Canvas>

注解

使用此枚举类的成员设置Placement Popup控件的属性的值。Use the members of this enumeration class to set the value of the Placement property of a Popup control. PlacementTarget属性值与PlacementRectangle Popup 、和HorizontalOffset属性的值一起确定屏幕上显示的位置和方式。 VerticalOffset PlacementThe Placement property value, together with the values of the PlacementTarget, PlacementRectangle, HorizontalOffset and VerticalOffset properties, determines where and how a Popup appears on the screen. 有关详细信息,请参阅 Popup 放置行为For more information, see Popup Placement Behavior.

适用于

另请参阅