none
Composite WPF, TabControl, and Regions RRS feed

  • Question

  • I am creating a composite WPF application (NOT Silverlight) and I am not sure how to handle a TabControl. The UI should have a TabControl with three TabItems (Data, Graphs, Specifications). There are two ways of doing this in my mind.

    1. Have two regions, a TabRegion and a MainRegion. When I click a TabItem, say Graphs, "Graphs" is sent as a CommandParameter and is handled by my controller. The controller then loads the correct view in the MainRegion. With this approach my shell has only the TabRegion and MainRegion.

    2. Have three regions, a DataRegion, GraphsRegion, and SpecificationsRegion. In this approach the Shell has the TabControl element and TabItems declared. Inside each TabItem there would be a Grid with a corresponding region. Each view is loaded into each region and there would be no controller (at least not yet) because there is only one view per region.

    I have seen the ViewInjection QuickStart and it does not really clear things up for me so please don't tell me to just refer to that. Thanks in advance.

    Tuesday, June 15, 2010 12:42 PM

Answers

  • Hi BBauer,

    Sorry for the delayed reply! I was not familiar with composite application design before, so I have to spend some time studying on it.

    Well, I prefer the first approach you mentioned because it is more flexible. Suppose if there are more tab items in the future, you don't need to add region in the TabControl when adopting the first approach.

    Sincerely,
    Linda Liu


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by BBauer42 Wednesday, June 23, 2010 7:37 PM
    Wednesday, June 23, 2010 7:37 AM

All replies

  • Hi BBauer,

    This is a quick note to let you know that I'm performing research on this issue. But could you tell me your real concern about this issue?

    Sincerely,
    Linda Liu


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, June 17, 2010 10:36 AM
  • I am just wondering what the recommended design would be. If you were creating a composite application and had the scenario explained above, how would you implement it?

    1. Using two regions and four views. (Tab region > tab view, Main region > data view, graphs view, specs view, managed by controller).

    2. Using one region and one view. (Main Tab region > single view, like using a normal tab control)

    3. Using four regions and four views (Tab region > tab view, Data region > data view, Graphs region > graphs view, Specs region > specs view, no controller needed b/c 1 view per region here).

     

    I have successfully implemented #1 above but am not sure that was the best route. Thanks.

     

     

    Thursday, June 17, 2010 12:13 PM
  • Hi BBauer,

    Sorry for the delayed reply! I was not familiar with composite application design before, so I have to spend some time studying on it.

    Well, I prefer the first approach you mentioned because it is more flexible. Suppose if there are more tab items in the future, you don't need to add region in the TabControl when adopting the first approach.

    Sincerely,
    Linda Liu


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by BBauer42 Wednesday, June 23, 2010 7:37 PM
    Wednesday, June 23, 2010 7:37 AM
  • Yes, I have become pretty familiar with Composite Applications over the past two months and believe option 1 is the best as well. It is working great and I just had to add a tab like you mentioned. It was very easy to do so. Thanks.
    Wednesday, June 23, 2010 7:37 PM