Reputation: 602
I need a File chooser in my Xamarin.Forms app, but I am thinking, if that is possible in iOS?
I know it is possible on both Android and UWP, but as iOS uses Sandboxing, I do not know, if it is possible on iOS.
Or do I have to use Open In
, as I then need to redesign some of my app.
And if I have to do it in that way, can I then use that method on UWP?
Upvotes: 0
Views: 1933
Reputation: 2027
You can use the xamarin plugin file picker
Add the click event:
async void OpenFile(object sender, EventArgs e)
{
try
{
FileData filedata = await CrossFilePicker.Current.PickFile();
}
catch (Exception ex)
{
ExceptionHandler.ShowException(ex.Message);
}
}
But sometimes your will get the System.NotImplementedException
So you need to import dll for android and ios manually.
For Android you can find the dll at your_project_name\packages\Xam.Plugin.FilePicker.1.1.0\lib\MonoAndroid10
For IOS you can find the dll at your_project_name\packages\Xam.Plugin.FilePicker.1.1.0\lib\MonoTouch10
Upvotes: 1