Hello,
i forgot to mention that i use popup to register a new Medida, then i moved the picker to the popup to test.
This should be caused by the ViewModel being created twice in the main page and popup.
Does this issue occur if you call the add method using the following singleton mode?
private static readonly object padlock = new object();
private static MedidasViewModel instance;
public static MedidasViewModel Instace
{
get
{
lock (padlock)
{
if (instance == null)
{
instance = new MedidasViewModel();
}
return instance;
}
}
}
public MedidasViewModel()
{
Medidas = new ObservableCollection<Medida>();
GetAll();
instance = this;
}
// Class that calls pages and view models.
public MedidasViewModel MedidasView { get; } = MedidasViewModel.Instace;
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.