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?
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?
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
});