悬赏园豆:5
[已解决问题]
解决于 2008-08-27 21:25
<DIV class=cnblogs_code>当在xaml文件中设置Value值之后,编译解决方案后 预览时会报错!~~<BR>具体代码如下:<BR>Page.xaml<BR></DIV>
<DIV class=cnblogs_code><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><SPAN style="COLOR: #008080"> 1</SPAN><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">UserControl </SPAN><SPAN style="COLOR: #ff0000">x:Class</SPAN><SPAN style="COLOR: #0000ff">="SliderMaxValueTest.Page"</SPAN><SPAN style="COLOR: #ff0000"><BR></SPAN><SPAN style="COLOR: #008080"> 2</SPAN><SPAN style="COLOR: #ff0000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> xmlns</SPAN><SPAN style="COLOR: #0000ff">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</SPAN><SPAN style="COLOR: #ff0000"> <BR></SPAN><SPAN style="COLOR: #008080"> 3</SPAN><SPAN style="COLOR: #ff0000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> xmlns:x</SPAN><SPAN style="COLOR: #0000ff">="http://schemas.microsoft.com/winfx/2006/xaml"</SPAN><SPAN style="COLOR: #ff0000"> <BR></SPAN><SPAN style="COLOR: #008080"> 4</SPAN><SPAN style="COLOR: #ff0000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> Width</SPAN><SPAN style="COLOR: #0000ff">="400"</SPAN><SPAN style="COLOR: #ff0000"> Height</SPAN><SPAN style="COLOR: #0000ff">="300"</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">Grid </SPAN><SPAN style="COLOR: #ff0000">x:Name</SPAN><SPAN style="COLOR: #0000ff">="LayoutRoot"</SPAN><SPAN style="COLOR: #ff0000"> Background</SPAN><SPAN style="COLOR: #0000ff">="White"</SPAN><SPAN style="COLOR: #ff0000"> ShowGridLines</SPAN><SPAN style="COLOR: #0000ff">="True"</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 6</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">Grid.RowDefinitions</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">RowDefinition </SPAN><SPAN style="COLOR: #ff0000">Height</SPAN><SPAN style="COLOR: #0000ff">="150"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN style="COLOR: #0000ff">/></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">RowDefinition </SPAN><SPAN style="COLOR: #ff0000">Height</SPAN><SPAN style="COLOR: #0000ff">="*"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN style="COLOR: #0000ff">/></SPAN><SPAN style="COLOR: #000000"> <BR></SPAN><SPAN style="COLOR: #008080"> 9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">Grid.RowDefinitions</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">Slider </SPAN><SPAN style="COLOR: #ff0000">Maximum</SPAN><SPAN style="COLOR: #0000ff">="255"</SPAN><SPAN style="COLOR: #ff0000"> Minimum</SPAN><SPAN style="COLOR: #0000ff">="0"</SPAN><SPAN style="COLOR: #ff0000"> Value</SPAN><SPAN style="COLOR: #0000ff">="100.0"</SPAN><SPAN style="COLOR: #ff0000"> Grid.Row</SPAN><SPAN style="COLOR: #0000ff">="0"</SPAN><SPAN style="COLOR: #ff0000"> x:Name</SPAN><SPAN style="COLOR: #0000ff">="sld"</SPAN><SPAN style="COLOR: #ff0000"> Orientation</SPAN><SPAN style="COLOR: #0000ff">="Vertical"</SPAN><SPAN style="COLOR: #ff0000"> MaxHeight</SPAN><SPAN style="COLOR: #0000ff">="300"</SPAN><SPAN style="COLOR: #ff0000"> ValueChanged</SPAN><SPAN style="COLOR: #0000ff">="Slider_ValueChanged"</SPAN><SPAN style="COLOR: #0000ff">/></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">TextBlock </SPAN><SPAN style="COLOR: #ff0000">x:Name</SPAN><SPAN style="COLOR: #0000ff">="Val"</SPAN><SPAN style="COLOR: #ff0000"> Grid.Row</SPAN><SPAN style="COLOR: #0000ff">="1"</SPAN><SPAN style="COLOR: #ff0000"> Width</SPAN><SPAN style="COLOR: #0000ff">="200"</SPAN><SPAN style="COLOR: #ff0000"> </SPAN><SPAN style="COLOR: #0000ff">/></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">Grid</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">UserControl</SPAN><SPAN style="COLOR: #0000ff">></SPAN></DIV>
<DIV class=cnblogs_code><SPAN style="COLOR: #0000ff"> </SPAN></DIV>
<DIV class=cnblogs_code><SPAN style="COLOR: #0000ff">Page.xaml.cs<BR>
<DIV class=cnblogs_code>
<DIV class=cnblogs_code><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><SPAN style="COLOR: #008080"> 1</SPAN><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">namespace</SPAN><SPAN style="COLOR: #000000"> SliderMaxValueTest<BR></SPAN><SPAN style="COLOR: #008080"> 2</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_29_330_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_29_330_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_29_330_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_29_330_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_29_330_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_29_330_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_29_330_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_29_330_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_29_330_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_29_330_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080"> 3</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">partial</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Page : UserControl<BR></SPAN><SPAN style="COLOR: #008080"> 4</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_79_328_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_79_328_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_79_328_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_79_328_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_79_328_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_79_328_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_79_328_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_79_328_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN id=Codehighlighter1_79_328_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_79_328_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080"> 5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000"> Page()<BR></SPAN><SPAN style="COLOR: #008080"> 6</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_111_157_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_111_157_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_111_157_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_111_157_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_111_157_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_111_157_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_111_157_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_111_157_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN id=Codehighlighter1_111_157_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_111_157_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080"> 7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> InitializeComponent();<BR></SPAN><SPAN style="COLOR: #008080"> 8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> </SPAN><SPAN style="COLOR: #0000ff">private</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> Slider_ValueChanged(</SPAN><SPAN style="COLOR: #0000ff">object</SPAN><SPAN style="COLOR: #000000"> sender, RoutedPropertyChangedEventArgs</SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #0000ff">double</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> e)<BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG id=Codehighlighter1_265_322_Open_Image onclick="this.style.display='none'; document.getElementById('Codehighlighter1_265_322_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_265_322_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_265_322_Closed_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_265_322_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_265_322_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_265_322_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_265_322_Open_Text').style.display='inline';" src="http://space.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top> </SPAN><SPAN id=Codehighlighter1_265_322_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://space.cnblogs.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_265_322_Open_Text><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align=top> Val.Text </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> e.NewValue.ToString();<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top> }</SPAN></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG src="http://space.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></DIV>
<DIV class=cnblogs_code><SPAN><SPAN style="COLOR: #000000"> </SPAN></SPAN></DIV>
<DIV class=cnblogs_code><SPAN><SPAN style="COLOR: #000000">预览测试网页文件时报错:<BR>Microsoft JScript runtime error: Unhandled Error in Silverlight 2 <FONT color=#ff0000>Application AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 10 Position: 157]</FONT> at System.Windows.Application.LoadComponent(Object component, Uri xamlUri)<BR> at SliderMaxValueTest.Page.InitializeComponent()<BR> at SliderMaxValueTest.Page..ctor()<BR> at SliderMaxValueTest.App.Application_Startup(Object sender, StartupEventArgs e)<BR> at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)<BR> at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)<BR><BR>如果不设置 Slider 控件的Value值时,就很正常!<BR><BR>很是纳闷,哪位朋友帮我看下错哪了?难道是Silverlight版本问题?</SPAN></SPAN></DIV><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--></DIV></SPAN></DIV>