Home > Net >  Xamarin essentials FodlerPicker?
Xamarin essentials FodlerPicker?

Time:12-22

I am looking for a solution that lets the user pick the folder location where they want to save their file(s). I am aware of FilePicker in the Xamarin.Essentials package, but this only allows the user to pick individual files, not folders. I am trying to accomplish this for all 4 platforms (Windows, iOS, Mac, and UWP). Any help is greatly appreciated.

CodePudding user response:

You can only achieve with Xamarin what is natively possible. If you try to code using native iOS in Objective-C/Swift/SwiftUI, there's no way to select which folder in the photo gallery to save your pictures in. Therefore it's not technically possible to achieve a solution that you are looking for in all 4 platforms.

CodePudding user response:

For now, no FodlerPicker in Xamarin.Forms.

You could create your own custom folder picker like below. Use the TapGestureRecognizer to simulate the selecting operation to save to the specific location.

  <ListView ItemsSource="{Binding folders}">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Label Text="{Binding folder}">
                        <Label.GestureRecognizers>
                            <TapGestureRecognizer  Tapped="TapGestureRecognizer_Tapped"></TapGestureRecognizer>
                        </Label.GestureRecognizers>
                    </Label>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

You could post your requirement in GitHub. https://github.com/xamarin/Xamarin.Forms/issues

  • Related