title: Silverlight ASP.NET Transparent Background
body: <p>I just started learning Silverlight and I failed to use a transparent background for my Silverlight app in my asp.net page. I have searched on the internet and found that these two lines should fix it:</p>
  
  <pre><code>      &lt;param name="background" value="Transparent" /&gt;
        &lt;param name="pluginbackground" value="Transparent" /&gt;
  </code></pre>
  
  <p>but unfortunately it didn't. Here is the way i embed the Silverlight app:</p>
  
  <pre><code>&lt;form id="form1" runat="server" style="height:100%"&gt;
      &lt;div id="silverlightControlHost"&gt;
          &lt;object data="data:SilverlightApplication4," type="application/x-silverlight-2" width="100%" height="100%"&gt;
            &lt;param name="source" value="ClientBin/SilverlightApplication4.xap"/&gt;
            &lt;param name="onError" value="onSilverlightError" /&gt;
            &lt;param name="background" value="Transparent" /&gt;
            &lt;param name="pluginbackground" value="Transparent" /&gt;
            &lt;a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=4.0.50826.0" style="text-decoration:none"&gt;
                &lt;img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/&gt;
            &lt;/a&gt;
          &lt;/object&gt;&lt;iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"&gt;&lt;/iframe&gt;&lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>and this is my Silverlight code:</p>
  
  <pre><code>&lt;UserControl x:Class="SilverlightApplication4.MainPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      mc:Ignorable="d"
      d:DesignHeight="300" d:DesignWidth="400" Loaded="UserControl_Loaded" BorderBrush="Transparent"&gt;
  
  
      &lt;StackPanel x:Name="LayoutRoot" Height="147" Width="226" Background="Transparent"&gt;
          &lt;StackPanel.Resources&gt;
              &lt;Storyboard x:Name="FirstStoryBoard"&gt;
                  &lt;DoubleAnimation Storyboard.TargetName="FirstEllipse"
                            Storyboard.TargetProperty="Width"
                            To="1" AutoReverse="True"
                            Duration="00:00:01" /&gt;
              &lt;/Storyboard&gt;
          &lt;/StackPanel.Resources&gt;
  
          &lt;TextBlock Text="Hello, World!" HorizontalAlignment="Center" Name="txtMessege" /&gt;
          &lt;Ellipse Name="FirstEllipse" Height="100" Width="200" Fill="SlateBlue" /&gt;
          &lt;Button Name="FirstButton" Width="100" Content="Click" Click="FirstButton_Click" /&gt;
      &lt;/StackPanel&gt;
  
  &lt;/UserControl&gt;
  </code></pre>