[UWP]Cant see snap shot pictures in Pictures folder RRS feed

  • Question

  • I am trying to take snapshot of live running video. But when select button for capture, i dont see any picture in Pictures folder. Here is my code kidly help:


        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
                <MediaElement x:Name="mediaElement" HorizontalAlignment="Left" Height="486" Margin="10,10,0,0" VerticalAlignment="Top" Width="340"/>
                <StackPanel x:Name="RenderedGrid" Orientation="Horizontal">
                    <Button Content="Play" Margin="5" Height="45" Width="100"         Click="Button_Click"></Button>
                    <Button Content="Pause" Margin="5" Height="45" Width="100"         Click="Button_Click_1"></Button>
                    <Button Content="Capture" Margin="5" Height="45" Width="100"         Click="Button_Click_2"></Button>


    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices.WindowsRuntime;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    using Windows.Storage.Pickers;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Controls.Primitives;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Media.Imaging;
    using Windows.UI.Xaml.Navigation;
    // The Blank Page item template is documented at
    namespace tvfinal
        /// <summary>
        /// An empty page that can be used on its own or navigated to within a Frame.
        /// </summary>
        public sealed partial class MainPage : Page
            public MainPage()
            private void Button_Click(object sender, RoutedEventArgs e)
                mediaElement.Source = new Uri("");
            private void Button_Click_1(object sender, RoutedEventArgs e)
            private async void Button_Click_2(object sender, RoutedEventArgs e)
                RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap();
                await renderTargetBitmap.RenderAsync(RenderedGrid);
                var pixelBuffer = await renderTargetBitmap.GetPixelsAsync();
                var savePicker = new FileSavePicker();
                savePicker.DefaultFileExtension = ".png";
                savePicker.FileTypeChoices.Add(".png", new List<string> { ".png" });
                savePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                savePicker.SuggestedFileName = "snapshot.png";
    I really could not able to find out where is my picture going??? I also debugged but failed to understand. Kindly help.......

    • Edited by Barry Wang Thursday, August 4, 2016 9:50 AM title tag
    Monday, August 1, 2016 10:49 AM


  • Somehow I remember that RenderTargetBitmap cannot capture the medie element's screenshot, probably you can find such information from the MSDN documentation.

    If the mechanism does not allow to take screenshot, definitely you cannot find any image. 

    • Proposed as answer by Jayden Gu Wednesday, August 10, 2016 6:32 AM
    • Marked as answer by Barry Wang Friday, August 12, 2016 12:39 AM
    Friday, August 5, 2016 3:18 AM
  • Hello,

    The article use the RenderTargetBitmap to take snapshot for the normal UIElement, but the MediaElement is different from them. Video content in a MediaElement or CaptureElement can't be captured using RenderTargetBitmap. Please check it in the remark with the following link:

    Best Regards,

    Jayden Gu

    • Proposed as answer by Jayden Gu Wednesday, August 10, 2016 6:32 AM
    • Marked as answer by Barry Wang Friday, August 12, 2016 12:39 AM
    Friday, August 5, 2016 11:50 AM

All replies