All About SharePoint

Liedong(Ken) Zheng,SharePoint Leader at SIMPLOT

Archive for the ‘Silverlight’ Category

How to add SilverLight Web part in Sharepoint 2010

Posted by ken zheng on November 12, 2010

 

It is pretty easy to have SilverLight app. running in your SharePoint Site.

Here is a example you can add the SilverLight application into the feature then deployed to the server. But for quick test, you can manually.

Just create a new page add insert SilverLight Web Part in, then Go to SilverLight application Bin folder and find .XAP file upload to the same library.

image

Your config for the web part will look like

image

Tips:

If you have configured the web part right and the SilverLight still not showing. Close the IE then open again as there may be cache in your browser.

Posted in Sharepoint, Silverlight | Tagged: , | 1 Comment »

Fixing Error 2104: Could not download the Silverlight application. Check web server settings

Posted by ken zheng on April 7, 2010

Fixing Error: Unhandled Error in Silverlight 2 Application
Code: 2104
Category: Initializer Error
Message: Could not download the Silverlight application.
Check web server settings.

When you’re hosting Silverlight, you have to tweak your IIS6 or Appache settings to allow the server to know how to handle the extensions that it’s not familiar with. I’m sure in the future, Microsoft will encode this directly into new releases of IIS, but for now, you have to add these MIME types yourself.

.xaml application/xaml+xml
.xap application/x-silverlight-app
.xbap application/x-ms-xbap

To add the MIME types to IIS6:

1. Choose the Virtual Directory or Default Web Site in IIS
2. Open the context menu and choose “Properties”
3. Select the “HTTP-Headers” tab
4. Click the button labeled “File Types…” in MIME Map section
5. Choose “New Type” and type the extension from above into the extension field and the application type into the MIME type field.
6. After adding all 3, click “OK” then click “Apply” on the main menu. You’re done. No restart needed.

Posted in .Net, Silverlight | Tagged: , | 1 Comment »

Unable to see default Silverlight control in Toolbox

Posted by ken zheng on December 2, 2009

If you can’t see default Silverlight control in Toolbox, run “devenv /setup” or “/reestsettings” in Run or “Visual Studio 2008 Command Prompt”

Posted in Silverlight, VS2008, vs2010 | Tagged: | Leave a Comment »

InitializeError- Failed to load the application. It was built with an obsolete version of Silverlight

Posted by ken zheng on July 23, 2009

You may experience this problem when you try to run an existing SilverLight project.

I only know the quick and dirty solution to this problem. (at least, it worked for my app)
You’ll have to open the .xap file with an archive program like winara. Edit the AppManifest.xaml file, and change the version number into the current number (something like 2.0.30825.0). And your program should work.

Posted in Silverlight | Tagged: | Leave a Comment »

Silverlight 3 – Consumption of a WCF Service

Posted by ken zheng on June 21, 2009

I started to play with the SL3 with wcf, but keep getting the error when using default clientconfig file

Could not find default endpoint element that references contract ‘ProjectName.ServiceReference1.IService1′ in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

If you look at the config file you’ll see contract=”ServiceReference1.IService1″. This needs to be a fully qualified namespace, and should be changed to contract=”ProjectName.ServiceReference1.IService1″ (or whatever namespace is specified in your Reference.cs file)

Posted in Silverlight | Tagged: | Leave a Comment »

Switch SilverLight UserControl

Posted by ken zheng on July 30, 2008

Silverlight does not have the Page type, the term is currently used is RootVisual UserControl. RootVisual object is analogous to the root window in WPF and can only be set once for the lifetime of the app, and is effective once the Application’s Startup event is raised. But this not true, you can set RootVisual as many times you want. So Application_Startup can be used to call multiple Silverlight controls.

    <form id="form1" runat="server" style="height:100%;">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div  style="height:100%;">
            <asp:Silverlight ID="Xaml1" runat="server" InitParameters="ControlId=Page" Source="~/ClientBin/SilverlightApplication1.xap" MinimumVersion="2.0.30523" Width="100%" Height="100%" />
        </div>
    </form>
		<object data="data:application/x-silverlight," type="application/x-silverlight-2-b2" width="100%" height="100%">
			<param name="source" value="ClientBin/SilverlightApplication1.xap"/>
			<param name="onerror" value="onSilverlightError" />
			<param name="background" value="white" />
			<param name="initParams" value="ControlId=BookStore" />
			
			<a href="http://go.microsoft.com/fwlink/?LinkID=115261" style="text-decoration: none;">
     			<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
			</a>
		</object>

and in the App.xaml.cs

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            if (e.InitParams.ContainsKey("ControlId"))
            {
                switch (e.InitParams["ControlId"])
                {
                    case "BookStore":
                        this.RootVisual = new BookStoreWithConverters();
                        break;

                    case "Page":
                        this.RootVisual = new Page();
                        break;
                }
            }        
        }

Posted in Silverlight | Tagged: | 2 Comments »

Embedded Multiple Silverlight User Controls

Posted by ken zheng on July 23, 2008

Silverlight does not have the Page type, the term is currently used is RootVisual UserControl. RootVisual object is analogous to the root window in WPF and can only be set once for the lifetime of the app, and is effective once the Application’s Startup event is raised. But this not true, you can set RootVisual as many times you want. So Application_Startup can be used to call multiple Silverlight controls.

Create a Silverlight application in visual studio 2008
Add 3 new Silverlight controls and lets name them Header, Footer and Leftbar.
Now put some text in these controls so that they can be distinguished on the aspx page.

Call these control s in the Form of Testpageforsilverlightapplication and set the InitParameters.

Change the Application_Startup in App.xaml.cs as below.

private void Application_Startup(object sender, StartupEventArgs e)

{

if (e.InitParams.ContainsKey(“ControlId”))

{

switch (e.InitParams["ControlId"])

{

case “Header”:

this.RootVisual = new Header();

break;

case “Leftbar”:

this.RootVisual = new Leftbar();

break;

case “Footer”:

this.RootVisual = new Footer();

break;

}

}

}

Run the application and all the 3 controls can be seen on aspx page. If we put a breakpoint at Application_Startup and we can see that it is called as many times as there silverlight controls on aspx page.

Posted in Silverlight | Tagged: | 1 Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 28 other followers