question

MdNiazMahmud-0233 avatar image
0 Votes"
MdNiazMahmud-0233 asked Castorix31 answered

[WPF] Rounded Window Drop Shadow Problem

Hi,

I have a WPF window in my project, where the window will have a corner radius of 26. Using Drop Shadow, there are square corners of the shadow which looks odd. I have used as following...

<Border BorderThickness="1" CornerRadius="26" > <Border.Effect> <DropShadowEffect BlurRadius="15" Direction="-90" RenderingBias="Quality" ShadowDepth="2" Color="#FCFCFC" /> </Border.Effect>

Is there any way so that the shadow becomes rounded as the window is???

116016-capture.png


windows-wpf
capture.png (21.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
1 Vote"
Castorix31 answered

By setting a border around the main border, I get a rounded shadow :

116066-wpf-rounded-shadow.jpg

 <Border BorderBrush="Transparent" BorderThickness="10" CornerRadius="25" Background="Transparent">
                     <Border BorderBrush="Red" BorderThickness="4" CornerRadius="25" Name = "MainBorder">
  <Border.Effect> 
     <DropShadowEffect BlurRadius="15" Direction ="-90" RenderingBias ="Quality" ShadowDepth ="2" Color ="Red" />
 </Border.Effect>                        
                         <Border.Background>
                             <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                 <GradientStop Color="Yellow" Offset="0.0" />
                                 <GradientStop Color="Red" Offset="0.25" />
                                 <GradientStop Color="Blue" Offset="0.75" />
                                 <GradientStop Color="LimeGreen" Offset="1.0" />
                             </LinearGradientBrush>
                         </Border.Background>
                     </Border>
    </Border>




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.