Create a region in code?...

Nov 22, 2012 at 3:44 PM

Hi,

I'm adding Tabitems dynamically using a ObservableCollection in my ViewModel, but I want to assign each Tabitem with a Region name so I can inject a View.

How do you create the Region property in ContentControl  for the Tabitem in code to accomplish this?

Thanks!...

Nov 27, 2012 at 3:59 AM
Edited Nov 27, 2012 at 4:00 AM

I'm not sure I understand specifically the scenario.  The general approach for handling run time values (which is what I assume the dynamic Tabitems are) is to use an abstract factory.  Check out http://stackoverflow.com/questions/1943576/is-there-a-pattern-for-initializing-objects-created-via-a-di-container/1945023#1945023 as well as this collection of answers for inspiration: http://stackoverflow.com/questions/2280170/why-do-we-need-abstract-factory-design-pattern/2280289#2280289  

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com