Reputation: 1026
I am building a C# Windows Store app and I want to include a few image files with it for the app background. I want to let the user pick one of these images for the app background or pick from their own pictures. The FileOpenPicker.SuggestedStartLocation is only useful for picking from a predefined set of start locations. FilePicker contracts are too complex, include extra UI that appears within the file picker page, and let other apps get to my image files when they really should not have that access.
The only viable alternative so far is to create my own file picker page that looks close to the built-in page, but this is an ugly solution to what should not be this hard.
Upvotes: 1
Views: 607
Reputation: 1
Being unable to specify the exact start location in FileOpenPicker / FileSavePicker makes life less easy when developing a fully fledged Windows Desktop application in WinUI 3 / Windows App SDK (and UWP, but that one is outdated now). Everyone has to come up with their own UI which takes a lot of time and makes the file UX in different apps inconsistent to Windows users. It's been like this since the beginning of UWP and it seems unlikely that Microsoft is ever going to change it. Even the new MS Word has invented its own UI. A very sad reality for us who wants to create modern Windows apps. So to answer your question: You have to make your own UI to achieve what you want. Looking at MS Word's "This Computer" browser, you can at least get an idea of how it may look and function, it is nicely done:-)
Upvotes: 0
Reputation: 21919
The best way is to devise your own. Load your included images into a selectable GridView or such and add another button or a specific tile to let the user pick from elsewhere. I wouldn't try to make the basic functionality look like the file picker.
Neither the app's install location or app data folders are intended to be user data, so there isn't an in-box way to pick from them. Advanced users can point the FileOpenPicker at those locations, but there is nothing like SuggestedStartLocations to guide the user there.
Upvotes: 0