我正在寻找一种仅使用XAML在WPF中添加投影效果的简便方法。我想将其应用于ListView中的元素。
I'm looking for an easy way to add a Drop Shadow effect like in WPF, using XAML only. I would like to apply it for the elements in a ListView.
除了这样的实验,我什么都找不到: blogs.windows/buildingapps/ 2016/09/12 /为uwp创建创造美丽效果/#BIRDSebvmJwAFY5Y.97
I haven't found anything more than experiments like this: blogs.windows/buildingapps/2016/09/12/creating-beautiful-effects-for-uwp/#BIRDSebvmJwAFY5Y.97
似乎需要很多代码-背后。我想避免它。
It seems that it would requiere a lot of code-behind. I would like to avoid it.
推荐答案如果您想自己使用Composition API进行操作,确实可以完成很多工作。幸运的是,我们有了一个很棒的社区,而这些开源项目之一就是 UWP社区工具包。该工具包包含一个 DropShadowPanel 控件,它可以为您完成辛苦的工作。
If you want to do it yourself with the Composition API, it's quite some work indeed. Luckily we got a great community, and one of those open source projects is the UWP Community Toolkit. This toolkit contains a DropShadowPanel control that does the hard work for you.
<controls:DropShadowPanel BlurRadius="4.0" ShadowOpacity="0.70" OffsetX="5.0" OffsetY="5.0" Color="Black"> <Image Width="200" Source="Unicorn.png" Stretch="Uniform"/> </controls:DropShadowPanel>请注意,您必须为此将应用程序版本设置为10.0.14393.0(周年更新)效果。
Note that you'll have to set the app version to 10.0.14393.0 (Anniversary Update) for this effect.
更多推荐
通用Windows应用程序中的投影效果
发布评论