【问题标题】:Integrating Silverlight 4.0 with SharePoint 2007将 Silverlight 4.0 与 SharePoint 2007 集成
【发布时间】:2011-05-20 06:36:25
【问题描述】:

我创建了一个简单的 Sharepoint Web 部件,它承载了一个 silverlight 应用程序。我创建了一个用户控件,它从布局路径加载 usercontrol.ascx 并加载它。

public class SLSampleWP : System.Web.UI.WebControls.WebParts.WebPart
{
    /// <summary>
    /// Add the silverlight user control here
    /// </summary>
    protected override void CreateChildControls()
    {
        this.Title = "Silverlight Sample";

        //silverlight control
        Control ctrlSilverlight;

        //load the user control
        ctrlSilverlight = this.Page.LoadControl(@"/_layouts/SL.Samples/SL.Samples.AgeCategory.ascx");

        //add the control
        this.Controls.Add(ctrlSilverlight);

    }
}

用户控制 (ascx)

<div id="silverlightControlHost">
Silverlight Web Part
<br />
    <object data="data:application/x-silverlight," type="application/x-silverlight-2"
        width="100%" height="100%">
        <param name="source" value="/_layouts/SL.Samples/Silverlight.Samples.xap" />
        <param name="onerror" value="onSilverlightError" />
        <param name="background" value="white" />
        <param name="minRuntimeVersion" value="4.0.50917.0" />
        <param name="autoUpgrade" value="true" />
        <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
            <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
                style="border-style: none" />
        </a>
    </object>
</div>

但我没有在页面中呈现 Silverlight 控件。可能是什么问题。我对 Silverlight 很幼稚。

【问题讨论】:

    标签: sharepoint silverlight-4.0 sharepoint-2007


    【解决方案1】:

    您是否在 IIS 上注册了 MIME 类型?

    在 IIS 中注册文件扩展名 .XAP 和 .XAML 的 MIME 类型

    扩展 MIME 类型 .xaml 应用程序/xaml+xml .xap 应用程序/x-silverlight-app

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-02
      • 2011-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多