How to hide WPF Grid Overflow (like CSS overflow:hidden)
13,738
Normally you can use some container and set its ClipToBounds
to true
.
Related videos on Youtube
Author by
martinyyyy
Hi I'm Martin. I do stuff. Like a pretty neat multi-clipboard
Updated on June 03, 2022Comments
-
martinyyyy almost 2 years
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.
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>
-
Oybek over 11 yearsI'm to some extent new to WPF, though familiar with it for over a year. I'm amazed each time when I discover some new feature. WPF awesome. God bless the one who came up with this idea!