Condividi tramite


ContextMenuService.HasDropShadow Proprietà associata

Definizione

Ottiene o imposta un valore che indica se l'oggetto ContextMenu ha l'effetto ombreggiatura abilitato.

see GetHasDropShadow, and SetHasDropShadow
see GetHasDropShadow, and SetHasDropShadow
see GetHasDropShadow, and SetHasDropShadow

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

Quando si ContextMenu apre , il valore viene impostato sul valore di SystemParameters.DropShadow. L'impostazione di questa proprietà su true non ha alcun effetto se la SystemParameters.DropShadow proprietà è false.

Informazioni sulle proprietà di dipendenza

Elemento Valore
Campo Identificatore HasDropShadowProperty
Proprietà dei metadati impostate su true Nessuno

Si applica a

Vedi anche