棱镜Silverlight的:如何维持一个区域内的意见以特定的顺序 [英] Prism for Silverlight: How to maintain views in a specific order inside a region

查看:164
本文介绍了棱镜Silverlight的:如何维持一个区域内的意见以特定的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的排序是导航面板(这实际上是一个ItemControl)的SL和使用区域,允许每个模块添加了链接到面板。

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.

其他可行的选择是为了使被绑定到ItemControl该地区的意见收集,问题是ViewCollection是非常有限的,所以订货它是相当困难的。

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?

由于
阿里尔

推荐答案

在PRISM4你刚才应用ViewSortHintAttribute大家的意见:

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.

这篇关于棱镜Silverlight的:如何维持一个区域内的意见以特定的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆