The Window Background default value is White
, using Null
or Transparent
will make your window look black. I make some updates for your ControlTemplate
as:
<ControlTemplate TargetType="{x:Type Window}">
<Border Margin="10" BorderThickness="5" BorderBrush="Gray">
<Border.Effect>
<DropShadowEffect Color="Black" Opacity="0.3" Direction="270" BlurRadius="10" ShadowDepth="3" />
</Border.Effect>
<Grid Background="White">
</Grid>
</Border>
</ControlTemplate>
I perfer below method to make a drop shadow for the window:
xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
<Window.Style>
<Style TargetType="Window">
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="ResizeMode" Value="NoResize"/>
<Setter Property="shell:WindowChrome.WindowChrome">
<Setter.Value>
<shell:WindowChrome CaptionHeight="80"
GlassFrameThickness="0,0,0,1"
ResizeBorderThickness="10" />
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.IsHomePage, RelativeSource={RelativeSource Self}}"
Value="false">
<Setter Property="ResizeMode" Value="CanResize"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Style>
</Window>
The result picture is:
By the way, there is an answer which uses API to implement.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.