How to create the ANNEX field in a form in xamarin forms?

1

I have a form being developed in a mobile application, one of the fields will have to capture an attachment. I know how to do in html using input , so what would be the attribute to do this using xamarin forms?

    
asked by anonymous 15.02.2018 / 19:34

1 answer

1

Xamarin.Forms does not yet provide a component for file selection in your package.

However, there are some implementations (including open source) in that sense, as it is a very common need in applications.

Here you have two options:

Remembering that this type of component does not usually provide a visual interface, so its triggering must be imperative. For example, in your View you put a button and in the click event (or in the viewModel command) you trigger the action made available by the component, such as selecting, saving or opening a file.

Ex:

ICommand command = new Command(async () => 
{
    var fileData = await filePicker.Current.PickFile();
    // A partir daqui você usa o fileData como precisar
});
    
15.02.2018 / 21:16