ContextMenuService.PlacementRectangle Proprietà associata
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta l'area relativa alla quale viene posizionato il menu di scelta rapida all'apertura.
see GetPlacementRectangle, and SetPlacementRectangle
see GetPlacementRectangle, and SetPlacementRectangle
see GetPlacementRectangle, and SetPlacementRectangle
Esempio
Nell'esempio seguente vengono assegnati gli stessi ContextMenu pulsanti e vengono impostate le HasDropShadowproprietà , Placement, PlacementRectangleHorizontalOffset, e VerticalOffset per impostare su ContextMenu posizioni diverse per ogni pulsante.
<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>
Commenti
È possibile posizionare un oggetto impostando le ContextMenuproprietà , PlacementTargetPlacementRectangle, Placement, e HorizontalOffset .VerticalOffsetProperty Queste proprietà si comportano come per un oggetto Popup. Per maggiori informazioni, vedere Comportamento di posizionamento popup.
Informazioni sulle proprietà di dipendenza
| Elemento | Value |
|---|---|
| Campo Identificatore | PlacementRectangleProperty |
Proprietà dei metadati impostate su true |
Nessuno |