TabControl Composite Example

Nov 12, 2008 at 5:17 PM
Hi,
While ago I began to look into Composite WPF, and I wanted to learn this concept, which I want to use in some applications. One of my first problem was how to implement a Composite application that is TabControl based and the Shell should create the tab items dynamically, without allocating any pre-defined item controls. I have to say it took some time until I figure it out. I should mention that the answer was hidden inside all the Quick Starts specially in UIComposition. Anyway I thought I send an example to community, for those who want to do this and maybe not to spend the same time that I did. The example has a TabRegion, which will be used to dynamically load tab itmes inside this region. The template of the tab item will accecpt a text and an image for header. Each modules will set these properties. Shell application will check of initiated module if the module is presented in Modules folder it will be loaded, othewise the tabitem ignors. The Style.xaml file is the same as UIComposition. I added the Itemtab template inside the shell xaml file. This is becasue of 2 reason, first I wanted to show only the part has been modified and second, when I used the 

BasedOn

 

="{StaticResource SimpleTabItem}"

 

in Shell.xaml, I got the runtime error that SimpleTabItem cannot be found.

I appriciate any comments and pointers, if you feel for it. The example can be downloaded at http://hem.bredband.net/morteza_ar/TabModules.rar

Thanks
Morteza