More About This Website

All information is provided "AS IS" with no warranties, and confers no rights

« Great error messages! | Main | Including SilverLight.js »

SilverLight Panel

Having figured out how I want to setup my page to use SilverLight I wanted to figure out how to make it more cookie cutter to add one or  SilverLight Areas to my page. Similar to my CTCSilverLightMgr control I wanted some control that could keep me from writing the createSilverLight.js script file you keep seeing in the QuickStarts.

Here's what I want this control to do:

1)  take the place of the createMySilverLightPlugin() method

2) Allow me to define an area on the form like a Panel that will contain SilverLight content

3) Allow me to configure everything via a ASP.NET Server Control using the property editor

4) Allow me to provide alternate content if the browser doesn't have SilverLight installed - Yeah sure I'd love them to install it but do I really want 5 icons on my page each place I have a little bit of SilverLight content?

Here's my first attempt at the concept - it's a simple server control that you can drag and drop anywhere on your page and define a SilverLight Area - Using the properties you tell it what SilverLight xaml file to use and it will take care of the details of activating SilverLight in the area.

<cc1:CTCSilverLightArea ID="CTCSilverLightArea2" runat="server" AreaName="Area2"
Height="302px" Width="235px" XamlSource="~/Control1/Area2.xaml" >
<h1>Your seeing this because you don't have Silverlight Installed</h1>

At first I started this as a very empty WebControl then I realized that inheriting from Panel would get me a ton of existing capabilities. If you think about it what SilverLight wants is a <div> tag to host the control.  A ASP.NET Panel basically is a <div> tag - the best part of inheriting from Panel is that I can then use the contents as alternate content if the user doesn't have SilverLight installed.  Keep in mind my theory is if I have 2-3 places SilverLight is running on the page I only want one of them to possibly show the "Click Here To Install Logo"   - So adding a property PanelContentIfNotInstalled="False" I could have one set to show the standard SilverLight install logo.

The magic to getting the alternate content to work is checking the Silverlight.isInstalled("1.0") method. It's not clear if this is intended to be called publicly but I couldn't imagine Microsoft not making some type of method like this part of the public interface.  Using this method - if not installed and I want to show alternate content, I simply just don't call the SilverLight.CreateObject and guess what the default content on my Panel kicks in!

I really think it would be cool if Microsoft includes their own SilverLightPanel as part of the RTM product - You will see that as part of the ASP.NET Futures they are starting to think about SilverLight Server controls.  Currently they have a Media and a Xaml server control as part of it.

References (9)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Response: Silverlight Panel
    You've been kicked (a good thing) - Trackback from
  • Response
    Response: ringtones
  • Response
    bad credit
  • Response
    Response: Best Phones
    Best Phones
  • Response
    Response: Dinosaurs
  • Response
    Response: ringtones
    It can frequently get laborious to extract the reliable elvis ringtones text from the dreadful.
  • Response
    background video clips
  • Response
    Response: j23
    J23 hehe
  • Response
    Response: blog hosting
    blog hosting [url=]blog hosting[/url] blog hosting [url= ] blog hosting [/url]

Reader Comments (1)

cool resources on Silverlight

August 14, 2007 | Unregistered Commenterbayarsaikhan

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>