这是一个间歇性的问题,应用程序的前192个像素绘制完美,但下面的浏览器中的所有内容都是白色的,并且不响应点击。
这大约在一个月前开始,但直到今天才在开发机器上发生。在测试服务器上,它在不同的时间发生在不同的浏览器上,但它在Firefox,Chrome和IE 8上比在IE 7上更频繁地失败。有时浏览器的整个客户区域都是白色的,而不仅仅是部分低于192像素;我假设这是一个相关的问题,但我不确定。
在今天的开发机器上,它在IE(Visual Studio内部浏览器和IE 8)和FF上都失败了,但在Chrome下运行。
以下是详细信息:
有人可以建议修复或进一步诊断吗?提前谢谢。
Default.aspx的
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="iVG.Web.Default" %>
<!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 id="Head1" runat="server">
<title>iVoterGuide.com</title>
<style type="text/css">
html, body {
height: 100%;
overflow: auto;
}
body {
padding: 0;
margin: 0;
}
#silverlightControlHost {
height: 100%;
text-align:center;
}
</style>
<script type="text/javascript" src="Silverlight.js"></script>
<script type="text/javascript">
function onSilverlightError(sender, args) {
var appSource = "";
if (sender != null && sender != 0) {
appSource = sender.getHost().Source;
}
var errorType = args.ErrorType;
var iErrorCode = args.ErrorCode;
if (errorType == "ImageError" || errorType == "MediaError") {
return;
}
var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\n";
errMsg += "Code: " + iErrorCode + " \n";
errMsg += "Category: " + errorType + " \n";
errMsg += "Message: " + args.ErrorMessage + " \n";
if (errorType == "ParserError") {
errMsg += "File: " + args.xamlFile + " \n";
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
else if (errorType == "RuntimeError") {
if (args.lineNumber != 0) {
errMsg += "Line: " + args.lineNumber + " \n";
errMsg += "Position: " + args.charPosition + " \n";
}
errMsg += "MethodName: " + args.methodName + " \n";
}
throw new Error(errMsg);
}
function CloseMainWindow(x) {
window.close();
}
</script>
</head>
<body onload="document.getElementById('SilverlightControl').focus();">
<form id="form1" runat="server"> <%--style="height:100%"--%>
<div id="silverlightControlHost">
<object id="SilverlightControl" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/iVG.xap"/>
<param name="enableHtmlAccess" value="true" />
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50401.0" />
<param name="autoUpgrade" value="true" />
<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><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe>
</div>
</form>
</body>
</html>
MainPage.xaml中
<Grid x:Name="LayoutRoot" Style="{StaticResource GridRoot}" Background="Green" Loaded="LayoutRoot_Loaded">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Style="{StaticResource GridMenu}" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Sticky:Tab x:Name="TabMenu" DisplayMemberPath="Text" Style="{StaticResource MainTabMenu}" Grid.Column="1" SelectionChanged="TabMenu_SelectionChanged" Margin="0"/>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top">
<TextBlock FontSize="{StaticResource FontSizeSmall}" VerticalAlignment="Center" Foreground="Black" x:Name="BlockSignedIn"/>
</StackPanel>
<Border x:Name="BorderContent" Style="{StaticResource BorderContent}">
<Grid HorizontalAlignment="Stretch">
<TextBlock Margin="0,-6,-2,0" HorizontalAlignment="Right" VerticalAlignment="Top" FontSize="{StaticResource FontSizeSmall}" Foreground="Black" x:Name="BlockTimestamp"/>
<StackPanel>
<Border Style="{StaticResource BorderPageHeader}">
<TextBlock x:Name="BlockHeader" Style="{StaticResource BlockPageHeader}" Text=""/>
</Border>
<navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrame}" MinHeight="300" Navigating="ContentFrame_Navigating"
Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
<navigation:Frame.UriMapper>
<sdk:UriMapper>
<sdk:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
</sdk:UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
<Grid Height="5"/>
<Border Style="{StaticResource BorderPageFooter}">
<TextBlock x:Name="BlockVersion"/>
</Border>
</StackPanel>
</Grid>
</Border>
<Grid Visibility="Collapsed" VerticalAlignment="Top" Background="Red" x:Name="GridDebug">
<TextBlock Text="DEBUG" FontWeight="Bold" Foreground="White" Margin="2"/>
</Grid>
</Grid>
</Grid>
答案 0 :(得分:0)
我得到了它的工作,虽然我不知道为什么。在Default.aspx页面下面的行中,我改变了 高度= “100%” 至 高度= “2000”
<object id="SilverlightControl" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
如果省略“height”或者它是“auto”,它仍然不起作用。如果“高度”太大,它也会失败(以不同的方式) - 例如5000。