Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide WPF Grid Overflow (like CSS overflow:hidden)

I'm currently creating a metro styled app. Because of this I need to extend my client area out of my window to draw the shadow. The problem now is that I have a button set to Margin="0,0,15,15" and of course it draws itself also in this shadow area. How can I hide this? In CSS I would just apply overflow:hidden to the "Content" or the UserControl.

problem

The basic WPF structure is like this:

<Grid x:Name="LayoutRoot" SnapsToDevicePixels="True" Margin="15" Background="White">
    <Grid.Effect>
        <DropShadowEffect ShadowDepth="0" BlurRadius="15" Direction="470"/>
    </Grid.Effect>
        <Grid x:Name="Content">
        <UserControl></UserControl> // This is where the arrow button is with Margin="0,0,15,15"
    </Grid>
</Grid>
like image 292
martinyyyy Avatar asked Aug 01 '11 12:08

martinyyyy


1 Answers

Normally you can use some container and set its ClipToBounds to true.

like image 192
H.B. Avatar answered Nov 09 '22 20:11

H.B.