How to control UIElements and their visibility?

Topics: CAB & Smart Client Software Factory
Oct 14, 2005 at 4:37 PM
originally posted by: Adrain

My question is, how do you keep UIElements for one workitem visible when you have multiple workitems that are visible in the shell form and are sharing the application's drawing surface (such as in a zoneworkspace)? Since a workitem is deactivated when another workitem gets the focus (because it becomes activated), even though the first workitem is still visible.

I refer you to the Bankteller sample in the latest CAB release, since it illustrates what I mean. If you run the application, accept a customer, then select the customer so you are showing the customer's details. Notice how it has added the "Customer" & "Edit" menuitems, since these relate to the customer workitem. Now if you click the "Accept Customer" button again, notice how the menu items are now not visible, even though we are still looking at the first customer's details (i.e. to a user, it is still active)?

The reason the menuitems disappear is because in CustomerWorkItem.OnDeactivate() it sets the visible property to false, which is what I do in my application, but unfortunatly that just won't work. Even when flicking between customers it has a rather ugly blinking effect since, especially if you give the customer details view the focus each time.

Is there another way to achieve the desired behaviour? (without hooking into the smartpart's visibleChanged event)