Prism-MEF: How to export view to certain tab in a tabcontrol using ViewExport

Topics: Prism v4 - WPF 4
Jan 22, 2013 at 7:55 AM

I don't know if this is possible or not: i have a Navigation Region that is populated with View_A (via ViewExport) @ program Start up from which i can select an item so its details will be displayed in main region. But now i want to put TabControl in the Navigation region with many TabItems each tab will caontain diffrent View: View_A, View_B, .... so i can use multiple control panels. So can i programmatically assign View_A to Tab_A and View_B to Tab_B ... so i can switch navigation panels. Thanks in advance

Note: each view has its view model imported in the code behind

Jan 22, 2013 at 4:29 PM


Based on my understanding of your scenario, If you are adding a TabControl with several Tab Items to your Navigation Region, I believe you could try defining a different region in each of your Tab Items, this way you could registered each View to its corresponding region in one of these Tab Items for example using the ViewExport attribute approach.

On the other hand, if you are defining the region in your TabControl and you need to specify the order on how the views will appear in this region, I believe you could benefit of the ViewSortHint attribute provided with Prism, which could also be used with the ViewExport attribute. For more information about this you could check the following section of the documentation:

I hope you find this handy,

Agustin Adami

Jan 22, 2013 at 7:17 PM

Hi aadami,

Thank you very much, you understand the problem and give easy solution. now i know where to ask my question if i need right and easy answer.

thanks and i hope you will be always around.