I have a ComboBox on a panel. The panel is part of a 'view' which is contained in a ViewStack. The ComboBox uses an ArrayCollection as it's dataProvider. I am able to change the value of the ComboBox (using the 'change' event), and that works fine.
The problem I have is when I leave that screen and come back to it, I'd like the ComboBox.selectedItem to be the one that was selected the last time. Instead, it seems that the ComboBox is defaulting to the first item in the list every time.
Is there a way to initialize a ComboBox value programatically to a specific value ? This seems like it should be really simple, but I am having a really hard time with it.
Any help would be appreciated. Thanks in advance.
If the combobox is changing its value, then you have some code that is changing its value. Are you resetting the dataprovider somewhere ?
You can assign the selectedItem property of the ComboBox (comboBox.selectedItem = value)
Furthermore, you can have a two-way binding between that property and a variable that you define.
That could be a way to keep the selected value...
(I hope it was clear enough)