Tell me how to make the file sharing service open at the touch of a button and suggest choosing a file, and then it would be displayed in a ListView.

  • What do you understand as файлообменник ? - sp7
  • Explorer, to put it simply. But I have already learned how to open it and even display the path to an image using FileOpenPicker. But I just can’t make this image appear in the tape ... - Denisok
  • It's not entirely clear what you want. Which file exchanger (local, network, cloud), what exactly do you want to display the file name, picture, path. - Alexsandr Ter
  • Local, display picture - Denisok

1 answer 1

Opening a dialog with FileOpenPicker . Description link: FileOpenPicker Class


Image display using BitmapImage link: BitmapImage class . Useful link: Image.Source Property


The links have a detailed description and examples.

Create an Image object in XAML, with no source and any other property values. And the C # code will look something like this:

 FileOpenPicker open = new FileOpenPicker(); StorageFile file = await open.PickSingleFileAsync(); if (file != null) { using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.DecodePixelWidth = 600; await bitmapImage.SetSourceAsync(fileStream); Scenario2Image.Source = bitmapImage; } } 

Use the SetSourceAsync method if you use image sources that are available for specifying Image objects only at run time, such as image files that a user can select by opening FileOpenPicker in the user interface.

  • And can I, as a beginner, add some comments after the condition?) - Denisok
  • @Denisok, open here this article Image.Source - here is described in some detail, I think you will understand. - Denis Bubnov
  • And you can still ask a question, how to save the downloaded images, as an object, or is the path simple? (for example, if I save every link from the Internet to Iist and build a GridView on it) - Denisok