views:

187

answers:

2

Hi

I am creating sort of a "Navigation panel" (which is actually an ItemControl) for SL and using Regions to allow each module to add his link to the panel.

Problem is that modules loading is inconsistent and thus order of links in the panel can change according to modules loading order.

Restricting the modules order is out of the question.

Other feasible option is the order the region's Views Collection that is binded to the ItemControl, the problem is that ViewCollection is very limited, so ordering it is pretty hard.

Did I miss an option, do you have an idea?

Thanks Ariel

+1  A: 

This is not built into Prism regions, however it's easily implementable.

Damian Schenkelman has posted an extension method he created for adding a region to an index that seems to work pretty well. http://blogs.southworks.net/dschenkelman/2009/03/14/how-to-add-a-view-to-a-region-in-a-particular-index-with-prism-v2/

Hope this helps.

Anderson Imes
No it's not a solution.Suppose you add a viewA in ModuleA at index 0, and viewB in ModuleB at index 1.if by chance ModuleB will get loaded first it will try to add it to index 1, and will fail.
ArielBH
@ArielBH: the example is easily modifiable to use string indexes (this is what I do personally). Hope this helps.
Anderson Imes
@Anderson can you share your modified code?
ArielBH
@ArielBH: I suppose so. You'll have to give me a little time to extract the relavent bits from the cruft.
Anderson Imes
@Anderson Thanks :) appreciate it.
ArielBH
A: 

Well as the lack of answers counting. I have not found a solution with Prism.

Instead I've used MEF to solve this.

I will write a blog post on it and update this place holder.

ArielBH