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

牧云@^-^@ 提交于 2019-12-06 13:29:30

问题


Apparently the effect is a feature introduced in the Creator's Update. Has anyone figured out the exact APIs used to pull this off? Even better would be some example code to at least help get me started.

Any help would be greatly appreciated. :]


回答1:


You should target Windows Creators Update for it to work

 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);


来源:https://stackoverflow.com/questions/43566178/how-to-replicate-the-window-transparency-effect-found-in-the-new-dropbox-uwp-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!