Question

Now when I save the image it will prompt out FileSavePicker. Can I programmatically save the image in local storage instead call the FileSavePicker. Please help Thanks.

   FileSavePicker savePicker = new FileSavePicker();
    savePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

    savePicker.FileTypeChoices.Add("PNG image", new List<string>() { ".png" });

    if (sourceFile == null)
    {
        this.Frame.Navigate(typeof(GroupedItemsPage));
    }

    savePicker.SuggestedFileName = "CroppedImage";
    StorageFile cropfile = await savePicker.PickSaveFileAsync();

    cropAndSaveImage(cropfile);
Was it helpful?

Solution

Yes. I would recommend reading the entire page here, because it covers most of the common variations you'll want to consider. In particular you will probably be interested in the ApplicationData.LocalFolder and the application data sample.

The solution will still involve getting a StorageFile at some point, of course, so it wouldn't be difficult to fit into the code you provided. Instead of opening a picker, you use CreateFileAsync method on a StorageFolder you get by using ApplicationData.LocalFolder (or one of the variations).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top