12

I am creating a custom Window form using Blend. (by setting AllowTransparency to True)

I've finished the design and it works pretty well. Now I want to add Shadow effect to it. (DropShadowEffect)

I can't do that because the Window itself is hidden so the effect won't show. And it doesn't work on the main Grid. No luck with adding a border and give the shadow to it.

xperator
  • 2,743
  • 7
  • 34
  • 58
  • This [SO post](http://stackoverflow.com/questions/3372303/dropshadow-for-wpf-borderless-window) is probably going to help you. – DHN May 24 '13 at 10:06
  • @DHN Thanks for the link, but the OP said he doesn't want the `AllowTransparency`. And the accepted answer code is based on a certain dll which doesn't give any control. Also, I want a Blend solution. – xperator May 24 '13 at 10:43
  • Ok, it was just a quick shot. Well I would suggest that you'd take the first visible element and give it a `DropShadow` effect. But I guess you've tried that already. ;o) – DHN May 24 '13 at 11:31
  • 1
    @DHN lol I think you should read everything first. ANyways, no matter what element you choose, they are all inside the Window control which is invisible due to the transparency. So any effect you apply is inside the window. – xperator May 24 '13 at 11:38

1 Answers1

16

Ok I found the answer. ( With some help from this page )

First of all, Set the window's AllowTransparency to True. Then change it's Background to No Brush

Lets say you have something like this: (Ignore the Rectangle and Borders)

enter image description here

Then change the Grid's Background to White color. Now click on your Window and Add about 15 pixels to its width and height.

enter image description here

And change the Shadow settings:

enter image description here

Now you can see the shadow :)

enter image description here

I think you got the idea how this is working. Remember you can still play around with the Window height/weight and the Shadow settings to get a better effect.

xperator
  • 2,743
  • 7
  • 34
  • 58