Here are the steps:
Step 1: Open a blank app and add a Button and a TextBlock either from the toolbox or by copying the following XAML code into your grid.
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <Button x:Name="captureButton" Content="Enable Capture" Click="captureButton_Click" />
- <TextBlock Name="status" Margin="0,10,0,0"></TextBlock>
- </StackPanel>
Step 2:
Copy and paste the following code to the cs page which will be called on button click event and will control the ScreenCapture and will show the status also:
- private void captureButton_Click(object sender, RoutedEventArgs e)
- {
- if (captureButton.Content.ToString() == "Enable Capture")
- {
- captureButton.Content = "Disable Capture";
- status.Text = "Screen Capturing is enabled";
- Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = true;
- }
- else
- {
- captureButton.Content = "Enable Capture";
- status.Text = "Screen Capturing is disabled";
- Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false;
- }
- }
When the ScreenCapture is disabled you will only get a black screen while trying to capture the same using any tool.
Step 3: Run your application and test yourself.


Avinash SurekaPosted Nov 10, 2018, 3:08 AM
Thanks Ramees, if I want to run application in background, and disable capturing anything on screen what can we do?
Kishor Bikram OliPosted Aug 26, 2016, 6:11 AM
How to capture the screen in windows 10 using C# programmatically?
Santhakumar MunuswamyPosted Jan 24, 2016, 10:25 AM
Thanks for nice share