如何访问 WCF RIA 生成的 Silverlight 应用程序中的字段
如何访问 WCF RIA 生成的 Silverlight 应用程序中的控件?
我已经使用许多查询字符串变量打开了页面 我想做的是将 Silverlight 控件上的控件值设置为这些值
编辑:似乎有三种方法,InitParams
、QueryString
和 HtmlPage.Document
有关 Brij Mohan 的完整详细信息 博客文章
How do you access the controls in a WCF RIA generated Silverlight app?
I've got the page being opened with a number of query string variables
What I'm trying to do is set the values of the controls on the Silverlight control to these values
EDIT: there seem to be three approaches, InitParams
, QueryString
and HtmlPage.Document
Full details on Brij Mohan blog post
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须记住,XAP 文件是从网站下载的第二个项目,而不是第一页。查看第一页的 Javascript,您将看到在命令行上发出许多参数来执行 Silverlight 应用程序。您可以在此处获取第一页上的 QueryString,并将其传递到 Silverlight 应用程序。几个链接给您...
CodeProject 示例- 显示了机制,但不是一个很好的实现
MSDN 文档
You have to remember that XAP file is the SECOND item that is downloaded from the website, it is not the first page. Look into the Javascript of the first page, you will see there are a number of parameters that are issued on the command line to execute the Silverlight application. It is here that you take the QueryString on the first page, and pass it on to the Silverlight application. Couple of links for you....
CodeProject Example - Shows the mechanics, but not a great implementation
MSDN Documentation
Silverlight/WPF/XAML 中的绑定是您的朋友:-)。 TwoWay 绑定模式不仅会将值获取到控件,还会返回到 WCF RIA 生成的对象。
MVVM(模型-视图-视图模型)就是为了帮助实现这一点而创建的。我不确定您对 Silverlight 了解多少,但我个人不想在没有它的情况下使用 XAML 进行开发。网上有很多教程。我发现以下内容应该对您有帮助: http:// /code.msdn.microsoft.com/silverlight/MVVM-Sample-for-WCF-RIA-115b1f38
Binding in Silverlight/WPF/XAML is your friend :-). The TwoWay binding mode will not only get the values to the control, but back to the WCF RIA generated objects.
MVVM (Model-View-ViewModel) was created to help in just that. I'm not sure how much you know about Silverlight, but personally I wouldn't want to develop in XAML without it. There are lots of tutorials on the web. Here is one I found that should help you: http://code.msdn.microsoft.com/silverlight/MVVM-Sample-for-WCF-RIA-115b1f38