Which view to view

Topics: CAB & Smart Client Software Factory
Mar 22, 2006 at 10:50 AM
originally posted by: DanHSLDA

Situation: I have a workitem with 2 different views. My menubar has a combobox where you can select which view you want to use the NEXT time you open the workitem.

Question: In the Show routine of the workitem how do I find out which option is currently selected in the combobox?
Mar 22, 2006 at 1:02 PM
originally posted by: ChrisHolmes

Sounds like a job for the State bag to me.

You could have your ComboBox fire an event that the RootWorkItem subscribes to (or even your childWorkItem, though I'd tend to put Shell-level UI Event Subscriptions in the RootWorkItem). The subscriber to the vent then pushes a config value (current ComboBox value) into the State bag. Dependency Inject the State into your childWorkItems and you'll have the value of the ComboBox wherever you need it. This gives you the added benefit of being able to use the StatePersistenceService to save the value of the combo box when the application is not in use, and have it next time the user opens it.