Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight ASP.NET透明背景_Asp.net_Silverlight_Background_Transparent - Fatal编程技术网

Silverlight ASP.NET透明背景

Silverlight ASP.NET透明背景,asp.net,silverlight,background,transparent,Asp.net,Silverlight,Background,Transparent,我刚开始学习Silverlight,但在asp.net页面中我的Silverlight应用程序没有使用透明背景。我在互联网上搜索了一下,发现这两行应该可以解决这个问题: <param name="background" value="Transparent" /> <param name="pluginbackground" value="Transparent" /> 但不幸的是,它没有。以下是我嵌入Silverlight应用程序的方式:

我刚开始学习Silverlight,但在asp.net页面中我的Silverlight应用程序没有使用透明背景。我在互联网上搜索了一下,发现这两行应该可以解决这个问题:

      <param name="background" value="Transparent" />
      <param name="pluginbackground" value="Transparent" />

但不幸的是,它没有。以下是我嵌入Silverlight应用程序的方式:

<form id="form1" runat="server" style="height:100%">
    <div id="silverlightControlHost">
        <object data="data:SilverlightApplication4," type="application/x-silverlight-2" width="100%" height="100%">
          <param name="source" value="ClientBin/SilverlightApplication4.xap"/>
          <param name="onError" value="onSilverlightError" />
          <param name="background" value="Transparent" />
          <param name="pluginbackground" value="Transparent" />
          <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
              <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
          </a>
        </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    </form>

这是我的Silverlight代码:

<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">


    <StackPanel x:Name="LayoutRoot" Height="147" Width="226" Background="Transparent">
        <StackPanel.Resources>
            <Storyboard x:Name="FirstStoryBoard">
                <DoubleAnimation Storyboard.TargetName="FirstEllipse"
                          Storyboard.TargetProperty="Width"
                          To="1" AutoReverse="True"
                          Duration="00:00:01" />
            </Storyboard>
        </StackPanel.Resources>

        <TextBlock Text="Hello, World!" HorizontalAlignment="Center" Name="txtMessege" />
        <Ellipse Name="FirstEllipse" Height="100" Width="200" Fill="SlateBlue" />
        <Button Name="FirstButton" Width="100" Content="Click" Click="FirstButton_Click" />
    </StackPanel>

</UserControl>

尝试使用以下参数:

<param name="background" value="Transparent" />
<param name="windowless" value="True" />


您可能还需要重新启动浏览器。

尝试使用以下参数:

<param name="background" value="Transparent" />
<param name="windowless" value="True" />


您可能还需要重新启动浏览器。

我也尝试过这些参数,但现在我发现,当我在测试网页上尝试使用这些参数时,它可以工作,而当我将相同的代码复制到我的正常网页时,它不会,并且总是显示白色背景。下面是我使用的代码:背景设置为红色,这样我就能看到差异,而pluginbackground设置为透明,使应用程序透明。非常感谢上面的解决方案。它解决了这个问题。我也尝试过这些参数,但现在我发现,当我在测试网页上尝试使用这些参数时,它是有效的,而当我将相同的代码复制到我的正常网页时,它不会并且总是显示白色背景。下面是我使用的代码:背景设置为红色,这样我就能看到差异,而pluginbackground设置为透明,使应用程序透明。非常感谢上面的解决方案。它解决了这个问题。