当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Xamarin forms: Windows 10 Universal App prevent screenshot

问题描述:

Hi I am building an app using Xamarin forms PCL project. In this app, I want to prevent users from taking screenshot so for android I tried-

this.Window.SetFlags(WindowManagerFlags.Secure, WindowManagerFlags.Secure);

In mainactivity.cs

For windows 10 and 8.1 I found-

Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false;

I tried to put it in MainPage.xaml.cs in UWP project. but my app dont start at all after this. Only splash screen is shown.

Where to place this line of code?

public sealed partial class MainPage

{

public MainPage()

{

this.InitializeComponent();

Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false;

LoadApplication(new FISE.App());

}

}

网友答案:

are you calling somewhere Window.Current.Activate() ? this should be in the App.xaml.cs

分享给朋友:
您可能感兴趣的文章:
随机阅读: