发生了XAMLParseException

时间:2015-02-18 02:15:14

标签: c# xaml

在我的XAML代码中,我得到了一个奇怪的错误,我无法弄清楚如何修复。我收到一条错误说明:

PresentationFramework.dll中出现'System.Windows.Markup.XamlParseException'类型的第一次机会异常

其他信息:'Verton_For_Windows_Desktop.MainWindow'的初始化引发了异常。行号'66'和行位置'7'。

这是我的代码:

<Controls:MetroWindow x:Class="Verton_For_Windows_Desktop.MainWindow"
    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Verton Ai" Height="573.523" Width="358.453" BorderBrush="Black" Background="{x:Null}" GlowBrush="#FF1768FF" WindowTitleBrush="#FF2470FF" TitleForeground="White" Foreground="#FF2470FF" Topmost="True" ShowMaxRestoreButton="False" SaveWindowPosition="True" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" SnapsToDevicePixels="True" SizeToContent="Height">
<Controls:MetroWindow.Resources>
    <Storyboard x:Key="openButton">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="button">
            <EasingDoubleKeyFrame KeyTime="0" Value="44"/>
            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="12"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="button">
            <EasingDoubleKeyFrame KeyTime="0" Value="-2"/>
            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="-2"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
</Controls:MetroWindow.Resources>
<Controls:MetroWindow.Triggers>
    <EventTrigger RoutedEvent="UIElement.MouseEnter" SourceName="button"/>
    <EventTrigger RoutedEvent="FrameworkElement.Loaded">
        <BeginStoryboard Storyboard="{StaticResource openButton}"/>
    </EventTrigger>
</Controls:MetroWindow.Triggers>
<Grid Background="#FF1768FF">
    <Button x:Name="Button1" HorizontalAlignment="Left" Margin="121,455,0,0" VerticalAlignment="Top" Width="81" Style="{DynamicResource MetroCircleButtonStyle}" Height="81" BorderBrush="White" BorderThickness="2" Foreground="{x:Null}" FontSize="200" FontStyle="Italic" Cursor="Hand" Click="Button_Click" RenderTransformOrigin="-0.119,0.431">
        <Button.Background>
            <ImageBrush ImageSource="C:\Users\Blake Weissman\OneDrive\Extra Curricular Stuff\Verton\Verton New\WindowsIcons-master\WindowsPhone\dark\appbar.microphone.png"/>
        </Button.Background>
        <Button.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Button.RenderTransform>
    </Button>
    <TextBox HorizontalAlignment="Left" Height="48" Margin="10,402,0,0" TextWrapping="Wrap" Text="Type Your Command Here, Or Click The Microphone Button To Say Your Command" VerticalAlignment="Top" Width="332" FontSize="15" FontFamily="Segoe UI Light" Background="White" BorderBrush="{x:Null}" Foreground="#FF1768FF" Uid="commandText" IsKeyboardFocusedChanged="TextBox_IsKeyboardFocusedChanged"/>
    <TextBox HorizontalAlignment="Left" Height="374" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="332" Foreground="#FF1768FF" BorderBrush="{x:Null}" FontFamily="Segoe UI Light" FontSize="20"/>
    <Button x:Name="button_Copy2" HorizontalAlignment="Left" Margin="286,480,0,0" VerticalAlignment="Top" Width="66" Style="{DynamicResource MetroCircleButtonStyle}" Height="66" BorderBrush="White" BorderThickness="2" Foreground="{x:Null}" FontSize="200" FontStyle="Italic" Cursor="Hand" Click="Button_Click" RenderTransformOrigin="-0.119,0.431">
        <Button.Background>
            <ImageBrush ImageSource="C:\Users\Blake Weissman\OneDrive\Extra Curricular Stuff\Verton\Verton New\WindowsIcons-master\WindowsPhone\dark\appbar.settings.png"/>
        </Button.Background>
        <Button.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Button.RenderTransform>
    </Button>
    <Button x:Name="button_Copy" HorizontalAlignment="Left" Margin="0,480,0,0" VerticalAlignment="Top" Width="66" Style="{DynamicResource MetroCircleButtonStyle}" Height="66" BorderBrush="White" BorderThickness="2" Foreground="{x:Null}" FontSize="200" FontStyle="Italic" Cursor="Hand" Click="Button_Click" RenderTransformOrigin="-0.119,0.431">
        <Button.Background>
            <ImageBrush ImageSource="C:\Users\Blake Weissman\OneDrive\Extra Curricular Stuff\Verton\Verton New\WindowsIcons-master\WindowsPhone\dark\appbar.settings.png"/>
        </Button.Background>
        <Button.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Button.RenderTransform>
    </Button>
</Grid>

1 个答案:

答案 0 :(得分:0)

行号和位置告诉您问题所在。文件的最后一行 - 缺少控件的结束标记:MetroWindow