In that reply, whose question has a little more detail about the implementation in question, you can see an example of how to use this resource.
Basically, you can use the property SelectedItem
of Picker
to make Binding with your View Model.
Since you didn’t share the code, I also don’t know how to give a specific answer, but it would be something like this:
In the view model create the property representing the selected item:
public class Minhaviewmodel : Inotifypropertychanged
{
...
private Objeto objetoSelecionado;
public Objeto ObjetoSelecionado
{
get { return objetoSelecionado; }
set
{
if(objetoSelecionado != value)
{
objetoSelecionado = value;
OnPropertyChanged("ObjetoSelecionado");
}
}
}
...
}
In the page XAML, do the Binding
with the equivalent property:
<Picker SelectedItem="{Binding ObjetoSelecionado}"
ItemsSource="{Binding ListaObjetos}"
...
/>
I hope I’ve helped.
Hello Diego, thank you for answering. It worked, I managed to get the selected value in my Viewmodel, I thank you too.
– Q.Wesley
@Q.Wesley Good, glad I can help. Good development!
– Diego Rafael Souza