當在xaml文件中設置Value值之后,編譯解決方案后 預覽時會報錯!~~具體代碼如下:Page.xaml
1<UserControl x:Class="SliderMaxValueTest.Page" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 Width="400" Height="300"> 5 <Grid x:Name="LayoutRoot" Background="White" ShowGridLines="True"> 6 <Grid.RowDefinitions> 7 <RowDefinition Height="150" /> 8 <RowDefinition Height="*" /> 9 </Grid.RowDefinitions>10 <Slider Maximum="255" Minimum="0" Value="100.0" Grid.Row="0" x:Name="sld" Orientation="Vertical" MaxHeight="300" ValueChanged="Slider_ValueChanged"/>11 <TextBlock x:Name="Val" Grid.Row="1" Width="200" />12 </Grid>13</UserControl>
Page.xaml.cs
1namespace SliderMaxValueTest 2{ 3 public partial class Page : UserControl 4 { 5 public Page() 6 { 7 InitializeComponent(); 8 } 910 private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)11 {12 Val.Text = e.NewValue.ToString();13 }14 }15}
預覽測試網頁文件時報錯:Microsoft JScript runtime error: Unhandled Error in Silverlight 2 Application AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 10 Position: 157] at System.Windows.Application.LoadComponent(Object component, Uri xamlUri) at SliderMaxValueTest.Page.InitializeComponent() at SliderMaxValueTest.Page..ctor() at SliderMaxValueTest.App.Application_Startup(Object sender, StartupEventArgs e) at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args) at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)如果不設置 Slider 控件的Value值時,就很正常!很是納悶,哪位朋友幫我看下錯哪了?難道是Silverlight版本問題?
Silverlight Slider 控件 莫名奇妙 報錯
慕田峪7331174
2018-12-06 18:06:55