简体   繁体   English

如何复制在新的DropBox UWP应用中找到的窗口透明度效果

[英]How to replicate the window transparency effect found in the new DropBox UWP app

Apparently the effect is a feature introduced in the Creator's Update. 显然,效果是创建者更新中引入的功能。 Has anyone figured out the exact APIs used to pull this off? 有没有人知道用于实现此目标的确切API? Even better would be some example code to at least help get me started. 更好的是一些示例代码,至少可以帮助我入门。

Any help would be greatly appreciated. 任何帮助将不胜感激。 :] :]

You should target Windows Creators Update for it to work 您应该以Windows Creators Update为目标,使其正常工作

 using Windows.UI.Xaml.Hosting;

 //'this' is MainPage, but can be any UIElement
 var visual = ElementCompositionPreview.GetElementVisual(this);
 var brush = visual.Compositor.CreateHostBackdropBrush();
 var sprite = visual.Compositor.CreateSpriteVisual();
 sprite.Brush = brush;
 //Set to the size of the area, update on SizeChanged
 sprite.Size = new System.Numerics.Vector2(1000, 1000); 
 ElementCompositionPreview.SetElementChildVisual(this, sprite);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM