How to convert BitmapImage into StorageFile? RRS feed

  • Question

  • While drag and drop of an image i need to convert BitmapImage into StorageFile to upload it. 

               DataPackageView dataPackageView = Clipboard.GetContent();
               if (dataPackageView.Contains(StandardDataFormats.Bitmap))
                            RandomAccessStreamReference img = await dataPackageView.GetBitmapAsync();
                            var imgstream = await img.OpenReadAsync();
                            BitmapImage bitmap = new BitmapImage();
                            StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(bitmap.UriSource.ToString()));

                            IUploadFileModel   _uploadModel = ObjFactory.Instance.CreateUploadFileModel();
                          _uploadModel.UploadFileAsync(file, user, OpenChatData.TeamID.ToString(), _isReadReceiptEnabled);



    Monday, June 29, 2020 2:14 PM

All replies

  • Hi laxmi,

    Thanks for posting here.

    This forum is for "Discuss general issues about developing applications for Windows." It is Win32 C++ development focused.

    For UWP related question you can post at UWP forum for more professional support.

    After some searching, I found a link that might be useful to you.

    Hope to help you.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 30, 2020 9:24 AM