2017-05-03 86 views
0

我想在我的項目中爲彈出窗口設置陰影。但是當我運行它時,陰影不會出現。 我寫了這個代碼:wpf彈出陰影不顯示

<Popup x:Name="popup" IsOpen="False" Width="200" Height="200" Placement="AbsolutePoint" AllowsTransparency="True" PopupAnimation="Fade" > 
     <Grid> 
      <Border BorderThickness="1" Background="#FF4CAAC7" CornerRadius="6" > 
       <Border.Effect> 
        <DropShadowEffect BlurRadius="15" Opacity="0.8" ShadowDepth="10" Direction="-90" RenderingBias="Quality" /> 
       </Border.Effect> 
       <StackPanel Orientation="Horizontal"> 
        <Grid Width="200" Background="Transparent"> 
         <Grid.RowDefinitions> 
          <RowDefinition Height="Auto"/> 
          <RowDefinition Height="Auto" /> 
         </Grid.RowDefinitions> 
         <TextBlock Grid.Row="0" FontWeight="Bold" TextAlignment="Right" Margin="10">Operation was successful</TextBlock> 
        </Grid> 
       </StackPanel> 
      </Border> 
     </Grid> 
    </Popup> 

設計陰影show.in運行,而不是show.what是問題!

回答

1

陰影在Popup的內邊緣被切斷。在Popup中爲它留出更多空間,讓邊框具有足夠的餘量,爲它周圍的陰影創造空間。

<Border 
    BorderThickness="1" 
    Background="#FF4CAAC7" 
    CornerRadius="6" 
    Margin="0,0,15,15" 
    >