Sharepoint silverlight web 部件 - 问题
我需要在 sharepoint 2010 中显示 silverlight webpart。
这是我的代码,用于在 Silverlight 中显示 silverlight 控件
protected override void CreateChildControls()
{
Silverlight sl = new Silverlight();
sl.ID = "CustomWebPart1SL";
sl.Source = "/Silverlight/CustomWebPart.xap";
this.Controls.Add(sl);
}
,我只是对数据进行热编码,以便图表在 Sharepoint 页面中正确呈现。
问题是我无法从 silverlight 应用程序访问 Sharepoint 列表。
如何从 silverlight 应用程序访问列表和属性包。或者我如何将这些数据作为 DataTable 从 WebPart 代码传递到 silverlight。
而且silverlight不支持DataTable对象。这是什么原因呢。
I need to show a silverlight webpart in sharepoint 2010.
This is my code, to show silverlight control
protected override void CreateChildControls()
{
Silverlight sl = new Silverlight();
sl.ID = "CustomWebPart1SL";
sl.Source = "/Silverlight/CustomWebPart.xap";
this.Controls.Add(sl);
}
In Silverlight I just hotcoded the data so the chart is rendering correctly in Sharepoint page.
The problem is I couldn't access Sharepoint list from silverlight application.
How to access the list and property-bag from silverlight application. Or how can I pass those datas as DataTable to silverlight from WebPart code.
And silverlight not supporting DataTable object. What is the reason.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于 SilverLight,我建议使用 SharePoint 客户端对象模型。为了获得良好的起点,您应该访问:此
For SilverLight I should suggest using of Client Object Model for SharePoint. For good starting point you should visit: this
Silverlight 应用程序在客户端计算机上运行,Sharepoint 在服务器上运行。
Silverlight 应用程序访问 Sharepoint 列表的唯一方法是通过客户端对象模型(如果您在 Sharepoint 2010 上运行)或使用 Sharepoint Web 服务(在 Sharepoint 2007 或更低版本上)。
/_vti_bin/ 文件夹中有许多开箱即用的服务,可用于读取和写入任何内容。
或者,您可以将包含数据的 xml 文件保存在文档库中,并从 Silverlight 应用程序中读取它。
但这意味着每次更新源列表时(使用事件接收器或使用计划作业),您都必须更新 xml 内容。
Silverlight applicatons run on the client machine, Sharepoint on the a server.
The only way a Silverlight application can access Sharepoint lists is by Client Object Model (if you are running on Sharepoint 2010) or consuming Sharepoint web services (on Sharepoint 2007 or previous).
There are many out-of-the-box services in the /_vti_bin/ folder useful for reading and writing anything.
Alternatively you can save an xml file containing your data in a document library and read it from the Silverlight application.
But this means that you have to update the xml content everytime the source list is updated (with event receivers or using a scheduled job).