TabItems from View collection

Posted by byte on Stack Overflow See other posts from Stack Overflow or by byte
Published on 2010-06-09T11:41:44Z Indexed on 2010/06/10 9:42 UTC
Read the original article Hit count: 282

Filed under:
|
|

I am using MVVM. I have a tab control. I will have a collection of items. I want to display each of this item in the collection as a tab item. The view in each tab item is different and may have its own viewmodel. How do I achieve this? E.g. I have 3 items in the collection. The Tab item template contains an ItemControl. I would like to now have 3 Tabs created and the ItemControls inside each tabitem may be showing different views.

One way I could do is have a single view and viewmodel for each item. Now based on some condition the View will display different UI elements and behave differently. But I am afraide this will make the view quite complex over a period of time.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about mvvm