开发者

i don't see silverlight project on test.aspx in Firefox,explorer etc?

i try to learn silverlight but i don't understand why silverproject cannot show on SilverlightTest page


<UserControl x:Class="SilverlightApplication1.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300">
    <Canvas x:Name="cnvLayoutRoot" Background="White">
        <TextBlock x:Name="tblText" Canvas.Top="20" Canvas.Left="30" Text="Not clicked yet."></TextBlock>
        <Button x:Name="btnTest" Canvas.Top="60" Canvas.Left="30" Click="btnTest_Click" Content="Click me!"></Button>
    </Canvas>
</UserControl>


C# codes


<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
    TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>SilverlightApplication1</title>
    <style type="text/css">
    html, body {
        height: 100%;
        overflow: auto;
    }
    body {
        padding: 0;
        margin: 0;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server" style="height:100%;">开发者_如何学编程
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div  style="height:100%;">
            <asp:Silverlight ID="Silverlight1" runat="server" Source="~/ClientBin/SilverlightApplication1.xap" MinimumVersion="3.0.40307.0" Width="100%" Height="100%" />
        </div>
    </form>
</body>
</html>


I don't know if this is relevant (as I have used the asp:Silverlight control successfully myself), but Visual Studio generates the following code in the test aspx page when I create a Silverlight project:

<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
      <param name="source" value="ClientBin/SilverlightApplication1.xap"/>
      <param name="onError" value="onSilverlightError" />
      <param name="background" value="white" />
      <param name="minRuntimeVersion" value="3.0.40624.0" />
      <param name="autoUpgrade" value="true" />
      <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
          <img src="http://go.microsoft.com/fwlink/?LinkId=108181" 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>

Can you try this and see if it makes a difference? As this doesn't then the problem must be somewhere else.

How have you included your user control on MainPage.xaml?


I've just pasted your XAML into a new project and run it in both IE and FF, check you web project properties in the Silverlight Applications section that your Silverlight proj is referenced.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜