Forums > C# >

DropShadow applies to Child Elements


Bones

deez nuts

Posts: 382

Threads: 10

Joined: Mar, 2021

Reputation: 11

Posted

Mods forgive me for posting XAML related stuff in C#, i don't have an other choice.

I want to add an shadow around the Window. I tried this piece of code 

        <Grid.Effect>
            <DropShadowEffect BlurRadius="15" Direction="-90"
                              RenderingBias="Quality" ShadowDepth="2"/>
        </Grid.Effect>

Instead of it applying to an Shadow around my Window, it applies to the Child Elements of the Grid. What am i doing wrong?

Who's Deez?

Nexus42

Nexus Pancakes

vip

Posts: 822

Threads: 55

Joined: Apr, 2020

Reputation: 18

Replied

use a border or something for the window instead of grid, then do border.effect and apply the drop shadow effect.

example make the grid tag just <grid><border background="#121212"></grid> that should work C:

Raptor Studios

CEO / Graphic Designer / Fullstack Developer

Bones

deez nuts

Posts: 382

Threads: 10

Joined: Mar, 2021

Reputation: 11

Replied

@Nexus42 I tried that, this only gives me an 90 Degree Shadow, but i want it to go fully around the Window.

Who's Deez?

Zander7473

Casual Femboy Agent

Posts: 1107

Threads: 32

Joined: Mar, 2020

Reputation: 13

Replied

@OrbitRBX

 

he said he wanted a drop shadow around the window not around the grid items.

 

Anyway to fix this you will need to use a border instead of an actual microsoft windowstyle, do windowstyle="none", resizemode as noresize and then do allowstransparency as true and get started

jon likes le tites

Laxion

The best is yet to come.

vip

Posts: 458

Threads: 29

Joined: Dec, 2018

Reputation: 19

Replied

You're meant to make the window completely transparent and only have the children shown, the Grid will basically be your window.

 

Set 'AllowTransparency' to true. Set 'ResizeMode' to 'NoResize'. Set 'WindowStyle' to 'None'. Set the background to transparent. Then have a border or a grid, add a margin to them, I always use a border and have the margin be 10 all around, then set a dropshadow on the border or grid and there you go.

 

Tell me if I missed out anything, thanks!

LaxionUI Designer / Developer | Programmer | Beginner Reverse Engineer
----------------------------------------------------------------------------
Discord: Laxion#7115
Founder of Acrylix

Bones

deez nuts

Posts: 382

Threads: 10

Joined: Mar, 2021

Reputation: 11

Replied

@Laxion Thank you

Who's Deez?