How to add custom file extension in Xamarin.Essentials file picker in all 3 platforms
Sk
66
Reputation points
I want to add custom file extension i.e. ".s37" in file picker filtering options. In UWP with the below code it is working fine but In android and ios not working
private async Task SelectFileClicked(object UTType)
{
var customFileType =
new FilePickerFileType(new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.iOS, new[] {"s37" } },
{ DevicePlatform.Android, new[] { "s37" }},
{ DevicePlatform.UWP, new[] { "s37" } },
});
var file = await FilePicker.PickAsync(new PickOptions
{
FileTypes = customFileType,
PickerTitle = "Pick an PDF"
});
if (file != null)
{
LblSelectedFileVisible = true;
LblSelectedFileName = file.FileName;
}
}
Developer technologies .NET Xamarin
5,380 questions
Sign in to answer