我在框架上加载的 xaml 页面中有以下代码。当我加载此页面时应用程序崩溃并且调试告诉我在线上有错误<Grid.Resources>
。请帮忙指出我哪里出错了
<Page x:Class="Milestones.Decade2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:s="http://schemas.microsoft.com/surface/2008"
xmlns:debug="clr-namespace:System.Diagnostics;assembly=WindowsBase"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="Decade2">
<Grid DockPanel.Dock="Left" Width="Auto" Height="Auto" >
<Grid.Resources>
<!-- The DataTemplate for a <Milestone> element. -->
<XmlDataProvider Source="Data/Decade2.xml" XPath="Milestones" x:Key="AllMilestones" IsInitialLoadEnabled="True"/>
<DataTemplate DataType="Milestone" x:Key="Milestones">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding XPath=@Name}" />
</StackPanel>
</DataTemplate>
<DataTemplate DataType="Milestone" x:Key="View">
<StackPanel FlowDirection="LeftToRight" Orientation="Horizontal">
<Image Source="{Binding XPath=./Media}" Width="250" Height="250" Grid.Column="0" />
<Canvas Grid.Column="1" Background="#0071bc" Height="Auto" >
<TextBlock TextWrapping="Wrap" Width="600">
<TextBlock TextWrapping="Wrap" FontSize="56" FontFamily="TitilliumText22L XBold" Text="{Binding XPath=@Name}" Padding="5" Foreground="White" />
<TextBlock TextWrapping="Wrap" FontSize="42" FontFamily="TitilliumText22L" FontWeight="Bold" Text="{Binding XPath=./Introduction}" Padding="5" Foreground="White"/>
<TextBlock TextWrapping="Wrap" FontSize="36" FontFamily="TitilliumText22L" Text="{Binding XPath=./Description}" Padding="5" Foreground="White" />
</TextBlock>
</Canvas>
</StackPanel>
</DataTemplate>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<!-- The top row is for the ListBox. -->
<RowDefinition Height="Auto" />
<!-- The bottom row is for the Image. -->
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<s:SurfaceListBox Grid.Row="3" IsSynchronizedWithCurrentItem="True" ItemsSource="Binding Source={StaticResource AllMilestones}, XPath=Milestones" ItemTemplate="{StaticResource Milestones}" Name="lstDecades2">
<s:SurfaceListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</s:SurfaceListBox.ItemsPanel>
</s:SurfaceListBox>
<!-- Displays the selected person's photo and name. -->
<DockPanel Grid.Row="1">
<ScrollViewer>
<ListBox Name="lbFiles"
ItemsSource="{Binding ElementName=lstDecades2, Path=SelectedItem, UpdateSourceTrigger=PropertyChanged}"
/>
</ScrollViewer>
</DockPanel>
<Image Source="Resources/images/logo.jpg" Height="186" Grid.Column="0" Grid.Row="0"></Image>
</Grid>
</Page>