UWPCommunityToolkit DropShadowPanel使Grid不会拉伸

时间:2018-05-31 15:20:59

标签: xaml uwp uwp-xaml windows-community-toolkit

我希望网格在屏幕上伸展同时还应用了阴影效果,出于某种原因,当放置在DropShadowPanel内部时,我可以将网格拉伸。

以下是所需结果的示例,但没有阴影效果:

<Grid Background="LightBlue">
    <Grid Background="WhiteSmoke" HorizontalAlignment="Stretch" Height="200" VerticalAlignment="Top" Margin="40"/>
</Grid>

结果:

enter image description here

这是我的带有DropShadowPanel的xaml:

<Grid Background="LightBlue">
    <controls:DropShadowPanel HorizontalAlignment="Stretch" Margin="40">
        <Grid Background="WhiteSmoke" HorizontalAlignment="Stretch" Height="200" VerticalAlignment="Top"/>
    </controls:DropShadowPanel>
</Grid>

这完全隐藏了第二个网格。

为什么网格在DropShadowPanel中的行为方式不同?

1 个答案:

答案 0 :(得分:6)

  

这完全隐藏了第二个网格。

问题是您没有设置HorizontalContentAlignmentDropShadowPanel属性。我修改了你的代码,如下所示。它有效。

root
相关问题