c# - UWP 内阴影与 LinearGradientBrush
问题描述
有什么办法可以产生这样的效果LinearGradientBrush
吗?
我还检查了这个问题:C# UWP Toolkit DropShadowPanel inner shadow
作为回答,他们使用DropShadowPanel
with Rectangle
,that has StrokeThickness="10"
。但这会创建灰色边框。我想知道是否有任何方法可以使用 LinearGradientBrush 或不将 StrokeThickness 设置为 10 来实现它?
我想保持网格的原始大小,不要以某种方式切割它。
解决方案
您可以像在另一个答案中一样使用 DropShadowPanel 并将内部矩形笔划更改为白色(或任何您的页面背景)。
<Grid Width="400" Height="200">
<Grid.Clip>
<RectangleGeometry Rect="0,0,400,200" />
</Grid.Clip>
<Rectangle Fill="Yellow" />
<TextBlock Text="Some text" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<controls:DropShadowPanel HorizontalContentAlignment="Stretch"
BlurRadius="50"
ShadowOpacity="1"
Color="Black">
<Rectangle Stroke="White"
StrokeThickness="10" />
</controls:DropShadowPanel>
</Grid>
这将创建以下内容:
推荐阅读
- python - Python:for循环填充字典项目它不应该
- c++ - 在堆或堆栈上分配的 std::queue 内存
- java - 将pdf文件加载到已经构建的jar
- c# - 如何在 SpringBoot 控制器中使用 WebClient.UploadFile (.NET) 上传的文件?
- html - svg 动画 奇怪的行为
- c# - 无法在 Web Api 控制器中设置 HttpResponseMessage 的 RequestUri
- java - 如何在 Java 中将汇编代码转换为机器代码
- r - 使用 R 根据公共变量组合数据框中的行
- c# - 带有批量电子邮件的 SmtpClient SendMailAsync 成功发送了大约 1200 封,其余的都失败了。任何指针?
- php - 使用ajax和php按价格排序