Bagikan melalui


ContextMenuService.HasDropShadow Properti Terlampir

Definisi

Mendapatkan atau mengatur nilai yang menunjukkan apakah ContextMenu efek bayangan drop diaktifkan.

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

Contoh

Contoh berikut menetapkan yang sama ContextMenu ke dua tombol dan mengatur HasDropShadowproperti , , PlacementPlacementRectangle, HorizontalOffset, dan VerticalOffset untuk mengatur ContextMenu ke posisi yang berbeda untuk setiap tombol.

<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>

Keterangan

ContextMenu Saat terbuka, nilai diatur ke nilai SystemParameters.DropShadow. Mengatur properti ini ke true tidak berpengaruh jika SystemParameters.DropShadow properti adalah false.

Informasi Properti Dependensi

Item Nilai
Bidang pengidentifikasi HasDropShadowProperty
Properti metadata diatur ke true Tidak

Berlaku untuk

Lihat juga