c# - 如何复制新 DropBox UWP 应用中的窗口透明效果

标签 c# xaml uwp uwp-xaml

显然,该效果是创作者更新中引入的一项功能。有没有人想出用于实现这一目标的确切 API?更好的是一些示例代码至少可以帮助我入门。

如有任何帮助,我们将不胜感激。 :]

最佳答案

您应该针对 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);

关于c# - 如何复制新 DropBox UWP 应用中的窗口透明效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43566178/

相关文章:

xaml - 如何在 XAML 中创建度数符号

xaml - 如何解决 Metro 风格应用程序中 XAML 中 webview 控件的 z-index 问题?

c# - (UWP) 使用 ESC 键关闭 ModalDialog

windows-8 - 是否可以在 Windows 应用商店应用程序中的用户之间共享数据?

c# - 如何自定义 UWP 页面的应用程序标题栏

c# - VS2010 - 找不到引用的组件 'X'。 - 禁用自动 "add reference"

c# - 如何从java调用DLL?

c# - 文件比较实用程序

c# - 具有不同数据类型数组作为值的字典

c# - 使用 WPF 和 MVVM 模式将值从子窗口传递到父窗口