我目前正在创建一个 metro 风格的应用程序。 因此,我需要将客户区扩展到窗外以绘制阴影。 现在的问题是我有一个设置为 Margin="0,0,15,15"的按钮,当然它也在这个阴影区域绘制自己。我怎么能隐藏这个?在 CSS 中,我只是将 overflow:hidden 应用到“Content”或 UserControl。
基本的WPF结构是这样的:
<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>
最佳答案
通常你可以使用一些容器并设置它的ClipToBounds
为 true
。
关于c# - 如何隐藏 WPF 网格溢出(如 CSS 溢出 :hidden),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6898243/