Sort Views

Topics: Prism v4 - WPF 4
Nov 30, 2010 at 5:33 PM

I'm using Prism 4 and WPF and I would like the views in a particular region to be in a specific order. I can't use the ViewSortHintAttribute since I'm creating some of the views at runtime. I'm adding items to a toolbar that has been marked as a region. So for instance, I'm adding views that are derived from Buttons, etc, plus I'm creating new instances of separators and adding them in between my derived views.

The documentation doesn't include much help and I've searched for hours online and so far I haven't found anyone who explains how to do this. How do I do this?

Nov 30, 2010 at 6:14 PM
Edited Nov 30, 2010 at 6:19 PM


There is no guidance for ordering Views out of the box in Prism. However, you could introduce your own logic for this.

You might find this blog post by Damian Schenkelman useful to this purpose. Although it is targeted at an older release of Prism, it could contain useful information and code that can be applied to Prism v4.

I hope you find this helpful.

Guido Leandro Maliandi


Nov 30, 2010 at 6:25 PM

Thanks. I've bookmarked that post.

I resolved my issue by restructuring some of my views so that I can use the ViewSortHintAttribute.

Nov 30, 2010 at 6:42 PM


I'm glad to see that you've solved your problem and thanks for sharing this with the rest of the community,since other users with a similar scenario might find this interesting.

Thanks again.

Guido Leandro Maliandi