HomeiOS Developmentc# - Maui picker not reset correctly on iOS

c# – Maui picker not reset correctly on iOS


The problem

I’ve a picker in my MAUI utility, with its ItemSource and SelectedItem sure to properties within the web page’s ViewModel. I even have a button to reset the picker, by setting the property sure to SelectedItem to null.

It really works completely superb on Android : I can choose a worth, then reset it and the picker correctly units again to the Title “Choose an merchandise”. Nevertheless, when I attempt to run it on iOS, the worth the picker shows keep unchanged, regardless of the viewmodel’s property being truly modified.

Tentatives

I attempted a number of issues to work round this concern, however no success :

  • Working with SelectedIndex as effectively, by setting it to -1
  • Resetting the property sure to ItemSource as effectively when resetting the Filter (setting the gathering to [] then repopulating it)
  • Making a customized conduct to deal with some logic from the web page’s facet
  • Working with the SelectedIndexChanged occasion to pressure the picker to have a null worth chosen

The final possibility I am contemplating is including a customized merchandise to the property sure to ItemSource for the “Choose an merchandise” possibility, however it’s clearly not ideally suited as in my actual venture, the gadgets in my picker are fairly advanced

Code

Hyperlink to a Minimal reproducible instance on GitHub

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments