Silverlight导航框架-regex之类的uri映射配置问题
我对我的应用程序的 URI 结构有一个想法,因此如果它以 #Home
结尾,它将导航到主框架。然而,如果它以类似 #{\d\d\d}
(此处为 3 位数字的正则表达式)结尾,它将导航到 #Home
并将这 3 位数字传递为一个参数。
我认为导航框架不支持大括号中 {parameters}
的正则表达式,并且通常需要 URI 映射中的 #Home/{id}
之类的内容。如果我只是做 #{id}
映射 #Home
,甚至 #AnotherPage
也会陷入其中。
如果我想坚持我的 URI 计划,我怎样才能实现这一点,最简单的方法?
I have an idea of URI structure for my app so if it ends with lets say #Home
it will navigate to main frame. If however it ends with something like #{\d\d\d}
(regex for 3 digits here) , it will navigate to #Home
and pass those 3 digits as a parameter.
I don't think navigation framework supports regexes for {parameters}
in curly brackets and it generally expects something like #Home/{id}
in URI mapping. and if i simply do #{id}
mapping #Home
and even #AnotherPage
will be caught into that too.
If I want to stick to my plan for URI how could I achieve that, the simplest way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可以实现自定义 urimapper 来实现此目的。以此为例:Silverlight 3 中区分大小写的 UriMapper 问题
..或者
您可以尝试类似
然后,在 Home.xaml.cs 中,您应该能够执行以下操作:
Maybe you could implement a custom urimapper to achieve this. Check this out as an example: Case sensitive UriMapper issue in Silverlight 3
..or
You could try something like
<uriMapper:UriMapping Uri="/Views/{myVar}Home" MappedUri="/Views/MainFrame.xaml"/>
<uriMapper:UriMapping Uri="/Views/{myVar}" MappedUri="/Views/Home.xaml?myVar={myVar}"/>
then, in Home.xaml.cs, you should be able to do the following: