Quantcast
Viewing all articles
Browse latest Browse all 7

Silverlight in SharePoint–Not greying out when dialog boxes popup

I’ve worked on some Silverlight projects for SharePoint recently, where a SharePoint web part has been created to load the Silverlight .XAP file, and display on a page.

This works really well, however, I have had a problem where there are other items on the SharePoint page that have modal dialog popups.. all the screen greys out EXCEPT the Silverlight web part.

Thankfully, there is a simple fix! When you create the SharePoint (non-visual) web part, and change the Render method in the <filename>.cs file, you would add something along the lines of:

protected override void Render(HtmlTextWriter writer)
{
            string siteUrl = Context.Request.Url.Scheme + "://" + Context.Request.Url.DnsSafeHost;

            string x =
                  "<object data='data:application/x-silverlight-4,' type='application/x-silverlight-2' width='100%' height='260px' style='z-index:-1;'>" +
                  "<param name='source' value='/XAPFile/SLCarousel.xap?ver=3'/>" +
                  "<param name='onError' value='onSilverlightError' />" +
                  "<param name='background' value='white' />" +
                  "<param name='minRuntimeVersion' value='4.0.50401.0' />" +
                  "<param name='autoUpgrade' value='true' />" +
                  "<param name='windowless' value='true' />" +
                  "<param name='initParams' value='MS.SP.url=" + siteUrl +
                  ",Parameter1=" + NewsListTitle +                  
                  ",CarouselTitle=" + CarouselTitle + "' />" +

                  "<a href='http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.0' style='text-decoration:none'>" +
                  "<img src='http://go.microsoft.com/fwlink/?LinkId=161376' alt='Get Microsoft Silverlight' style='border-style:none'/>" +
                  "</a>" +
                  "</object>";
            writer.Write(x);
            base.Render(writer);
 }

Note the line:

"<param name='windowless' value='true' />" + 

This is the line that will cause the Silverlight web part to be greyed out… this is case sensitive.  If you don;t have this line, then add it, and it you do have the line, then check that the case is correct.


Tagged: SharePoint 2010, Silverlight Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 7

Trending Articles