【问题标题】:ParseXamlException Windows Phone 8.1ParseXamlException Windows Phone 8.1
【发布时间】:2015-01-27 10:55:41
【问题描述】:

我在我的 Windows Phone 8.1 应用程序中收到错误:

找不到与此错误代码关联的文本 (ParseXamlException)

第 28 行第 28 列

<UserControl
    x:Class="ConnectorX_UniversalApp.UI.LoginUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:local="using:ConnectorX_UniversalApp.CommonUI">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="ms-appx:///Assets/CustomUI/background.png" Stretch="UniformToFill" />
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="120"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Vertical" Grid.Column="0">
                <TextBlock x:Uid="BuisnessConnectorTextBlock" Margin="5,15,0,0" FontSize="25" x:Name="BuisnessConnectorTextBlock" HorizontalAlignment="Stretch"/>
            </StackPanel>

Xaml 有效。我在另一台笔记本电脑上克隆并运行项目后出现此错误。

【问题讨论】:

    标签: c# xaml windows-phone-8.1


    【解决方案1】:

    您的应用在尝试创建 TextBlock 时似乎崩溃了。 您是否确定在您的 .resw 文件中有一个名为“BuisnessConnectorTextBlock”的资源?

    xaml 解析器将尝试查找指定的资源并将其属性应用于 TextBlock。如果资源不存在,解析器将抛出异常。此外,如果资源有任何不适合 TextBlock 的属性,您也会得到异常。

    (在我看来应该是“BusinessConnectorTextBlock”)

    【讨论】:

    • 答案几乎就在那里 - 我没有 en-EN 的资源(有 de-DE),但它是 appxmanifest 中的默认语言。似乎在将项目克隆到另一台笔记本电脑后,配置已重置。
    猜你喜欢
    • 2023-04-03
    • 2016-12-01
    • 1970-01-01
    • 2014-11-21
    • 1970-01-01
    • 1970-01-01
    • 2015-07-01
    • 2015-02-28
    • 2014-11-10
    相关资源
    最近更新 更多