【问题标题】:How to fix "Xaml parsing failed"?如何修复“Xaml 解析失败”?
【发布时间】:2019-10-16 18:32:36
【问题描述】:

我正在使用 Visual Studio Enterprise 2017。当我尝试在 Mobile Emulator 上运行我的 UWP 项目时,我收到“Xaml 解析失败”错误。 当我在“本地机器”上运行它时,一切正常。我从一开始就没有对 xaml 标头进行任何更改。谁能帮帮我?

下面的图片显示错误。 https://i.imgur.com/FL3Cr4K.jpg https://i.imgur.com/65A2t9y.jpg

<Page
    x:Class="KalkulatorBMI.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:KalkulatorBMI"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid Padding="10">
        <!--Padding - margines-->
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
            <!-- * zużywa co dostanie.-->
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0">
            <TextBlock Text="Trener persolany" Style="{ThemeResource CaptionTextBlockStyle}"/>
            <TextBlock Text="Użytkownik" Style="{ThemeResource HeaderTextBlockStyle}"/>
        </StackPanel>
        <StackPanel Grid.Row="1" >
            <ListBox Name="lbxUzytkownicy" HorizontalAlignment="Left" Width="150" Height="200" Margin="10" SelectedIndex="0"/>
            <Button Name="ButtonLoguj" Content="Loguj" Margin="10" Click="Click_Loguj"/>
            <StackPanel>
                <TextBlock Text="Nowy uzytkownik" Margin="10,0,0,5"/>
                <TextBox Name="TextboxNowy" Height="32" Width="138" Margin="10,0,0,0" HorizontalAlignment="Left"/>
                <TextBlock Name="TextboxZlaNazwa" Margin="10,5,0,0" Foreground="Red"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" >
                <Button Name="ButtonUtworz" Content="Dodaj użytkownika" Margin="10" Click="Click_Utworz"/>
                <Button Name="ButtonUsun" Content="Wyczyść listę" Margin="10" Click="Click_Usun"/>
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Row="2">
            <Button Name="ButtonZakoncz" Margin="10" Content="Zakończ"  Click="Click_Zakoncz" Foreground="Red"/>
        </StackPanel>
    </Grid>
</Page>

【问题讨论】:

  • 可以分享一下异常详情吗?

标签: c# visual-studio xaml uwp


【解决方案1】:

那么,您需要先检查应用的目标版本和最低版本,并确保 Mobile Emulator 已安装此 SDK 版本。如果没有,请从here下载if。

【讨论】:

    【解决方案2】:

    假设您的任何 Style 和 ThemeResource 定义中没有其他未显示的错误...

    从第一个 Grid 元素(第 11 行?)中删除 Padding="10"。网格控件不提供 Padding 属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-04
      • 2020-06-23
      • 1970-01-01
      • 2022-10-22
      • 2015-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多