Dynamic Views

Topics: CAB & Smart Client Software Factory
Dec 30, 2005 at 4:24 AM
originally posted by: jburtch

I have a scenario where I have many similar documents that when opened different views need to appear. It is all based on the properties of the objects I load. Different combinations of properties will result in different views. The value of some properties eliminate all other views while other properties imply that different views are available. I'm looking for the best way to model out this scenario. Because of the plethora of property combinations, creating different workitems for each valid set seems tedious at best. I was thinking about using WorkItemExtentions. It seems like I could have a series of these classes that would extend a single WorkItem derived class and after inspecting the model each could make the decision on whether or not to display a single SmartPart. Not quite sure how to handle the overriding properties that eliminate other views.

Perhaps it would be better to implement a single WorkItemExtension that uses Chain of Responsibility classes to add the views. In this way, the head of the chain could be comprised of these overriding rules and they could then skip further view addition.

Any suggestions would be appreciated.
Jan 4, 2006 at 6:35 AM
originally posted by: BradWilsonMSFT

Yeah, I wouldn't use separate WorkItems for this. It seems like you want separate views that maybe share a common presenter/controller, and some kind of factory that can examine the model data (and whatever other metadata is necessary) to determine which is the right view to create.