Xaml 解析失败。 Visual Studio 2013 'Windows.UI.Xaml.Markup.XamlParseException' 发生在 Sicuro.exe
Xaml parsing failed. Visual Studio 2013 'Windows.UI.Xaml.Markup.XamlParseException' occurred in Sicuro.exe
我正在开发 windows phone 8.1 应用程序。我有地图屏幕。这个屏幕工作完美,但现在我只是在这个屏幕上遇到这个异常。
this.InitializeComponent();
对此我遇到了异常 'Windows.UI.Xaml.Markup.XamlParseException'。
我无法得到任何解决方案。请帮我解决这个问题。更多信息见附件。
这是我的 Xaml 代码。
<Page.Resources>
<Thickness x:Key="PhoneBorderThickness">2.5</Thickness>
<FontFamily x:Key="PhoneFontFamilyNormal">Segoe WP</FontFamily>
<FontWeight x:Key="PhoneButtonFontWeight">Semibold</FontWeight>
<x:Double x:Key="TextStyleLargeFontSize">18.14</x:Double>
<Thickness x:Key="PhoneButtonContentPadding">9.5,0,9.5,3.5</Thickness>
<x:Double x:Key="PhoneButtonMinHeight">57.5</x:Double>
<x:Double x:Key="PhoneButtonMinWidth">109</x:Double>
<Thickness x:Key="PhoneTouchTargetOverhang">0,9.5</Thickness>
<SolidColorBrush x:Key="ButtonDisabledBackgroundThemeBrush" Color="Transparent"/>
<Style x:Key="ButtonStyle1" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{ThemeResource PhoneForegroundBrush}"/>
<Setter Property="Foreground" Value="{ThemeResource PhoneForegroundBrush}"/>
<Setter Property="BorderThickness" Value="{ThemeResource PhoneBorderThickness}"/>
<Setter Property="FontFamily" Value="{ThemeResource PhoneFontFamilyNormal}"/>
<Setter Property="FontWeight" Value="{ThemeResource PhoneButtonFontWeight}"/>
<Setter Property="FontSize" Value="{ThemeResource TextStyleLargeFontSize}"/>
<Setter Property="Padding" Value="{ThemeResource PhoneButtonContentPadding}"/>
<Setter Property="MinHeight" Value="{ThemeResource PhoneButtonMinHeight}"/>
<Setter Property="MinWidth" Value="{ThemeResource PhoneButtonMinWidth}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="Grid" Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Pressed" To="PointerOver">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
<VisualTransition From="PointerOver" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
<VisualTransition From="Pressed" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<ImageBrush ImageSource="ms-resource:/Files/Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver"/>
<VisualState x:Name="Pressed">
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="Grid"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<ImageBrush Stretch="Uniform"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<ImageBrush ImageSource="ms-appx:/Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledBorderThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{ThemeResource PhoneTouchTargetOverhang}">
<Border.Background>
<ImageBrush ImageSource="Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Fill"/>
</Border.Background>
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.Foreground>
<ImageBrush ImageSource="Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</ContentPresenter.Foreground>
</ContentPresenter>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Page.BottomAppBar>
<CommandBar Margin="0,0,0,0">
<AppBarButton x:Name="Home_Button" Label="HOME" Icon="Home" Click="Home_button_click">
<!--<AppBarButton.Background>
<ImageBrush Stretch="Fill" ImageSource="Assets/details.png"/>
</AppBarButton.Background>-->
</AppBarButton>
<AppBarButton x:Name="Message_Button" Label="MESSAGE" Icon="Message" Click="Message_button_Click"/>
<AppBarButton x:Name="Map_Button" Label="MAP" Icon="Map" Click="Map_button_Click"/>
<AppBarButton x:Name="Settings_Button" Label="SETTING" Icon="Setting" Click="Setting_button_Click"/>
</CommandBar>
</Page.BottomAppBar>
<Grid>
<Grid x:Name="Main_bg_grid" Background="#FF204371">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition />
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Sicuro"
FontSize="26" FontWeight="SemiBold"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Row="1">
<!--<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="Assets/App_images/drawable_xhdpi/blur_bg.png"/>
</Grid.Background>-->
<Maps:MapControl x:Name="Mymap" MapServiceToken="wu0BD4oAAvgN_rRNqXG7xg" HorizontalAlignment="Center" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Visible" Height="520" Width="400" Margin="0,0,0,0" ZoomLevel="24" />
</Grid>
<Grid Grid.Row="1" Width="240" Height="80" Background="Transparent"
VerticalAlignment="Bottom" Margin="0,0,0,40">
<Button x:Name="Check_in_button" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="0" Click="Check_In_Button_Click" Style="{StaticResource ButtonStyle1}">
<Button.Background>
<ImageBrush ImageSource="Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</Button.Background>
</Button>
</Grid>
<Grid Grid.Row="1" VerticalAlignment="Top" Height="80">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="92"/>
<ColumnDefinition />
<ColumnDefinition Width="92"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="Assets/App_images/drawable_xhdpi/mylocation_btn.png" Tapped="My_Location_Button_Tapped"></Image>
<!--<Image Grid.Column="2" Source="Assets/App_images/drawable_xhdpi/direction_btn.png"></Image>-->
</Grid>
<!--<Image x:Name="location_mark" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"
Source="Assets/App_images/drawable_xhdpi/location_marker_ic.png" Width="136" Height="102"/>-->
<ProgressBar x:Name="progressBar" Grid.Row="1"
IsIndeterminate="True"
Maximum="100" Value="30"
Height="10"
Width="400" VerticalAlignment="Center"/>
</Grid>
</Grid>
这是调用堆栈..
Sicuro.exe!Sicuro.Map.InitializeComponent() Line 44 C#
Sicuro.exe!Sicuro.Map.Map() Line 70 C#
Sicuro.exe!Sicuro.Sicuro_XamlTypeInfo.XamlTypeInfoProvider.Activate_7_Map() Line 200 C#
Sicuro.exe!Sicuro.Sicuro_XamlTypeInfo.XamlUserType.ActivateInstance() Line 502 C#
[Native to Managed Transition]
[Managed to Native Transition]
Sicuro.exe!Sicuro.Dashboard_Screen.Map_button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) Line 259 C#
mapscontrol 的 Zoomlevel 值应该在 1 到 20 之间
我正在开发 windows phone 8.1 应用程序。我有地图屏幕。这个屏幕工作完美,但现在我只是在这个屏幕上遇到这个异常。
this.InitializeComponent();
对此我遇到了异常 'Windows.UI.Xaml.Markup.XamlParseException'。
我无法得到任何解决方案。请帮我解决这个问题。更多信息见附件。
这是我的 Xaml 代码。
<Page.Resources>
<Thickness x:Key="PhoneBorderThickness">2.5</Thickness>
<FontFamily x:Key="PhoneFontFamilyNormal">Segoe WP</FontFamily>
<FontWeight x:Key="PhoneButtonFontWeight">Semibold</FontWeight>
<x:Double x:Key="TextStyleLargeFontSize">18.14</x:Double>
<Thickness x:Key="PhoneButtonContentPadding">9.5,0,9.5,3.5</Thickness>
<x:Double x:Key="PhoneButtonMinHeight">57.5</x:Double>
<x:Double x:Key="PhoneButtonMinWidth">109</x:Double>
<Thickness x:Key="PhoneTouchTargetOverhang">0,9.5</Thickness>
<SolidColorBrush x:Key="ButtonDisabledBackgroundThemeBrush" Color="Transparent"/>
<Style x:Key="ButtonStyle1" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{ThemeResource PhoneForegroundBrush}"/>
<Setter Property="Foreground" Value="{ThemeResource PhoneForegroundBrush}"/>
<Setter Property="BorderThickness" Value="{ThemeResource PhoneBorderThickness}"/>
<Setter Property="FontFamily" Value="{ThemeResource PhoneFontFamilyNormal}"/>
<Setter Property="FontWeight" Value="{ThemeResource PhoneButtonFontWeight}"/>
<Setter Property="FontSize" Value="{ThemeResource TextStyleLargeFontSize}"/>
<Setter Property="Padding" Value="{ThemeResource PhoneButtonContentPadding}"/>
<Setter Property="MinHeight" Value="{ThemeResource PhoneButtonMinHeight}"/>
<Setter Property="MinWidth" Value="{ThemeResource PhoneButtonMinWidth}"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="Grid" Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Pressed" To="PointerOver">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
<VisualTransition From="PointerOver" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
<VisualTransition From="Pressed" To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Grid"/>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background)" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<ImageBrush ImageSource="ms-resource:/Files/Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver"/>
<VisualState x:Name="Pressed">
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="Grid"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<ImageBrush Stretch="Uniform"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<ImageBrush ImageSource="ms-appx:/Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledBorderThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="Border">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonDisabledBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="{ThemeResource PhoneTouchTargetOverhang}">
<Border.Background>
<ImageBrush ImageSource="Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Fill"/>
</Border.Background>
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<ContentPresenter.Foreground>
<ImageBrush ImageSource="Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</ContentPresenter.Foreground>
</ContentPresenter>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Page.BottomAppBar>
<CommandBar Margin="0,0,0,0">
<AppBarButton x:Name="Home_Button" Label="HOME" Icon="Home" Click="Home_button_click">
<!--<AppBarButton.Background>
<ImageBrush Stretch="Fill" ImageSource="Assets/details.png"/>
</AppBarButton.Background>-->
</AppBarButton>
<AppBarButton x:Name="Message_Button" Label="MESSAGE" Icon="Message" Click="Message_button_Click"/>
<AppBarButton x:Name="Map_Button" Label="MAP" Icon="Map" Click="Map_button_Click"/>
<AppBarButton x:Name="Settings_Button" Label="SETTING" Icon="Setting" Click="Setting_button_Click"/>
</CommandBar>
</Page.BottomAppBar>
<Grid>
<Grid x:Name="Main_bg_grid" Background="#FF204371">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition />
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Sicuro"
FontSize="26" FontWeight="SemiBold"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
<Grid Grid.Row="1">
<!--<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="Assets/App_images/drawable_xhdpi/blur_bg.png"/>
</Grid.Background>-->
<Maps:MapControl x:Name="Mymap" MapServiceToken="wu0BD4oAAvgN_rRNqXG7xg" HorizontalAlignment="Center" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Visible" Height="520" Width="400" Margin="0,0,0,0" ZoomLevel="24" />
</Grid>
<Grid Grid.Row="1" Width="240" Height="80" Background="Transparent"
VerticalAlignment="Bottom" Margin="0,0,0,40">
<Button x:Name="Check_in_button" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderThickness="0" Click="Check_In_Button_Click" Style="{StaticResource ButtonStyle1}">
<Button.Background>
<ImageBrush ImageSource="Assets/App_images/drawable_xhdpi/check-in@2x.png" Stretch="Uniform"/>
</Button.Background>
</Button>
</Grid>
<Grid Grid.Row="1" VerticalAlignment="Top" Height="80">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="92"/>
<ColumnDefinition />
<ColumnDefinition Width="92"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="Assets/App_images/drawable_xhdpi/mylocation_btn.png" Tapped="My_Location_Button_Tapped"></Image>
<!--<Image Grid.Column="2" Source="Assets/App_images/drawable_xhdpi/direction_btn.png"></Image>-->
</Grid>
<!--<Image x:Name="location_mark" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center"
Source="Assets/App_images/drawable_xhdpi/location_marker_ic.png" Width="136" Height="102"/>-->
<ProgressBar x:Name="progressBar" Grid.Row="1"
IsIndeterminate="True"
Maximum="100" Value="30"
Height="10"
Width="400" VerticalAlignment="Center"/>
</Grid>
</Grid>
这是调用堆栈..
Sicuro.exe!Sicuro.Map.InitializeComponent() Line 44 C# Sicuro.exe!Sicuro.Map.Map() Line 70 C# Sicuro.exe!Sicuro.Sicuro_XamlTypeInfo.XamlTypeInfoProvider.Activate_7_Map() Line 200 C# Sicuro.exe!Sicuro.Sicuro_XamlTypeInfo.XamlUserType.ActivateInstance() Line 502 C# [Native to Managed Transition]
[Managed to Native Transition]
Sicuro.exe!Sicuro.Dashboard_Screen.Map_button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) Line 259 C#
mapscontrol 的 Zoomlevel 值应该在 1 到 20 之间