xaml - UWPCommunityToolkit DropShadowPanel 防止网格拉伸
问题描述
我希望网格在屏幕上伸展,同时应用阴影效果,由于某种原因,当放置在 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 中的行为不同?
解决方案
这完全隐藏了第二个网格。
问题是你没有设置HorizontalContentAlignment
. DropShadowPanel
我已经修改了您的代码,如下所示。它有效。
<controls:DropShadowPanel Margin="40"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
>
<Grid Background="Red" Height="200" HorizontalAlignment="Stretch"/>
</controls:DropShadowPanel>
推荐阅读
- twilio - 如何将按键发送到数字接收
- magento - 来自 CLI 的 Magento 1.14.2.1 到 Magento 2.3.2
- javascript - 如何通过jQuery在同一行中的另一个输入ID选择第n个输入文本框?
- ios - Ionic 4 - 目标为“_blank”的 InAppBrowser 在 IOS 上不起作用?
- r - 拆分数据框值并在 R 中放入一个组?
- ios - 快速获取 JSON 值
- javascript - javascript将html附加到之前附加
- angular - 如何使用 Compodoc 生成文档文件(pdf 或 doc)?
- ios - 第三方 iOS/iPadOS 应用程序是否能够访问存储卡/USB 闪存?
- reactjs - 如何在 React 网站中安全地保持用户的登录状态?