Hi, I am building a Windows form application using .NET 3.5. I would like to use the MVC design pattern. The app has two forms: a quick launch and a view showing the details. The quick launch just has a tree with 2 levels, so the tree structure looks something like
- Category 1
- Subcategory 1-1
- Subcategory 1-2
- Category 2
- Subcategory 2-1 etc,
When the user clicks on a category or subcategory, the details view displays all items belonging to that category or subcategory. An item can belong to only one of category or subcategory (the items in my app are really documents such as orders, invoices, etc). Category's item and subcategory's item have almost identical properties but there is still a bit difference.
I have a controller class that handles the click event raised by the quick launch. The controller determines whether the user clicks on a category and subcategory, then gets all the items that belong to that category or subcategory. It then sends all the items to the details view to display them.
My questions is that is it better to use one generalized details view or create a view for each of category and subcategory? If I were to use one generalized view, I need to show/hide a few fields depending on whether the items belong to a category or subcategory, which might make it harder to maintain if category's item structure and subcategory's item structure becomes more different in the future.
If I were to create a view for each of category and subcategory, the controller needs to add the category view and remove the subcategory view when the user clicks on a category node. This is what bugs me because the controller needs to add/remove view from the main form when the user clicks on a node, which doesn't look like a good design to me.
So neither seems like a good design. What's the correct solution to this problem?
EDIT: Which part is too vague. Basically, the user can see two types of items: CategoryItem and SubCategoryItem. SubCategoryItem is a child class of CategoryItem. In MVC pattern, do I need 2 views (call CategoryView and SubCategoryView) and the controller determine which view to render to the user? Or just one view so the controller always render this view and it's the view's job to determine whether to display CategoryView or SubCategoryItem?