ContextMenuService.HorizontalOffset 附加属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置指示沿 x 方向相对于父控件放置 ContextMenu 的位置的值。
see GetHorizontalOffset, and SetHorizontalOffset
	see GetHorizontalOffset, and SetHorizontalOffset
	see GetHorizontalOffset, and SetHorizontalOffset
	示例
以下示例将相同的 ContextMenu 分配给两个按钮,并将 HasDropShadow、 Placement、 PlacementRectangle、 HorizontalOffset和 VerticalOffset 属性设置为 ContextMenu 每个按钮的不同位置。
<StackPanel>
  <StackPanel.Resources>
    <ContextMenu x:Key="myContextMenu">
      <MenuItem Header="Item"/>
    </ContextMenu>
  </StackPanel.Resources>
  <!--Both buttons use the same ContextMenu but use the
    properties on ContextMenuService to position them
    differently.-->
  <Button ContextMenu="{StaticResource myContextMenu}" 
          ContextMenuService.HasDropShadow="False" 
          ContextMenuService.Placement="Relative"
          ContextMenuService.HorizontalOffset="50"
          ContextMenuService.VerticalOffset="-10">
    button 1
  </Button>
  <Button ContextMenu="{StaticResource myContextMenu}" 
          ContextMenuService.HasDropShadow="True"
          ContextMenuService.Placement="Right"
          ContextMenuService.PlacementRectangle="0,0,30,30">
    button 2
  </Button>
</StackPanel>
	注解
可以通过设置 、、PlacementRectangle、 PlacementHorizontalOffset和 VerticalOffsetProperty 属性来PlacementTarget定位 ContextMenu 。 这些属性的行为与对 Popup的行为相同。 有关详细信息,请参阅 Popup 放置行为。
依赖项属性信息
| 标识符字段 | HorizontalOffsetProperty | 
元数据属性设置为 true | 
无 | 
XAML 属性用法
<object HorizontalOffset="double"/>  
- or -  
<object HorizontalOffset="qualifiedDouble"/>  
XAML 值
              double
Double
值的字符串表示形式 Double 。 这被解释为与设备无关的单位, (1/96 英寸) 测量。 字符串不需要显式包含小数点。 例如,值是可以接受的 1 。
              qualifiedDouble
如上所述的 双精度 值,后跟以下单位声明字符串之一: px、 in、 cm、 pt。
              px (默认) 是与设备无关的单位, (单位) 1/96 英寸
              in 为英寸;1in==96px
              cm 为厘米;1cm== (96/2.54) px
              pt 是磅;1pt== (96/72) px