Dispatcher issue in PRISM 5.0 while loading TabItem dynamically

Topics: Prism v4 - WPF 4
Dec 15, 2014 at 12:10 PM

I am using PRISM 5.0.

I am new to PRISM and just started to dig into it for my complex project.

Currently I try to load TabItems dynamically at runtime using TabControl as a Region.

For that I have registered interface and its' class in Module's initialize method.

this.container.RegisterType<IABC, ABCViewModel>(); and resolved it in controller class


At above statement, it raised error "InvalidOperationException - The current type, myinterface.IXYZ, is an interface and cannot be constructed. Are you missing a type mapping?" for another interface/class. Then I register this interface in Module's initialize method.

I run the app again and it again raised error same as above for another interface/class. Then I have register that class in Module's initialize method.

To resolved such errors, I have registered 6 interface/class in Module's initialize method. Now it raised "InvalidOperationException - The type Dispatcher does not have an accessible constructor.". This Dispatcher doesn't have any constructor and it is class of System.Windows.Threading, so can't make any changes in Dispatcher.

Please let me know how to resolve this Dispatcher issue?

Am I on a right track to load TabItem dynamically using region? Or I am doing something wrong?

I need to register around 6 interface/class for just to load one TabItem dynamically. There are other 5 TabItem, I need to load dynamically using PRISM Region.

Kindly guide me on this issue and if I am wrong, suggest me the right way to load TabItem dynamically.

Ayaz Shaikh