【问题标题】:UWPCommunityToolkit DropShadowPanel keeps Grid from stretchingUWPCommunityToolkit DropShadowPanel 防止网格拉伸
【发布时间】:2018-05-31 15:20:58
【问题描述】:

我希望网格在屏幕上伸展,同时应用阴影效果,由于某种原因,当放置在 DropShadowPanel 内时,我无法伸展网格。

这是一个期望结果的示例,但没有阴影效果:

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

结果:

这是我的带有 DropShadowPanel 的 xaml:

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

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

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

【问题讨论】:

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


    【解决方案1】:

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

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

    <controls:DropShadowPanel Margin="40"
                              VerticalAlignment="Center"   
                              HorizontalAlignment="Stretch"
                              HorizontalContentAlignment="Stretch"
                              >
        <Grid Background="Red" Height="200" HorizontalAlignment="Stretch"/>
    </controls:DropShadowPanel>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-10
      • 2021-10-31
      • 1970-01-01
      • 2018-01-22
      • 1970-01-01
      • 2010-11-14
      • 1970-01-01
      • 2014-03-23
      相关资源
      最近更新 更多