Prism for Silverlight: How to maintain views in a specific order inside a region

后端 未结 6 943
心在旅途
心在旅途 2020-12-18 12:19

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 i

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-18 12:39

    In Prism4 you just apply the ViewSortHintAttribute to your views:

    [ViewSortHint("100")]
    class FirstView : UserControl { }
    
    [ViewSortHint("200")]
    class SecondView : UserControl { }
    

    The default sort comparer on the regions will pick up this attribute and sort the views accordingly. You can put any string into the attribute but I tend to use medium sized numbers that allow me to easily put a new view in between existing ones.

提交回复
热议问题