2014-12-14 2 views
1

Visual Studio IDE 2013에서 Windows Phone 8 프로젝트를 컴파일하려고하는데 MainPage.xaml의 구문 분석에 오류가 발생합니다.Windows Phone 8 프로젝트를 컴파일하는 XAML 구문 분석 예외

다음 코드에서는 오류 Windows.UI.Xaml.Markup.XamlParseException가 표시됩니다. 내가 잘못 했니? 문제는 AppBar 태그 시작 줄에서 기인합니다.

<Page 
    x:Class="MainStream.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:MainStream" 
    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> 
     <Image Grid.RowSpan="2" Stretch="None" Source="/img/sfondo.png" VerticalAlignment="Top" HorizontalAlignment="Center"/> 
     <FlipView x:Name="flipView1" Width="480" Height="270" Margin="0,10,0,0" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1"> 
      <Image Width="480" Height="270" Stretch="UniformToFill"/> 
      <TextBlock FontFamily="Segoe UI" FontSize="26.667" Foreground="#CCFFFFFF" Padding="15,20"/> 
     </FlipView> 

     <AppBar VerticalAlignment="Bottom" HorizontalAlignment="Center"> 
      <StackPanel Orientation="Horizontal"> 
       <AppBarButton Click="Play_Click" Label="Play" Icon="Play"/> 
       <AppBarButton Click="Pause_Click" Label="Pause" Icon="Pause"/> 
      </StackPanel> 
     </AppBar> 
    </Grid> 
</Page> 

오류 :

Cannot create instance of type '%0' [Line: 18 Position: 17] The text associated with this error code could not be found.

사람은 나에게 솔루션을 제안 할 수 있습니다?

+0

내가 틀릴 수도 있지만 AppBar는 Page 요소의 하위 여야한다고 생각합니다. 즉, 요소의 앞이나 뒤에 있어야합니다. – JayDev

+0

당신은 WP8 또는 WP8.1에 대한 코딩 방법은 확실 해요 그게 WP8의 응용 프로그램 막대에 대한 올바른 xaml 아니에요 – JayDev

+0

고맙습니다,하지만 Microsoft 문서에서 나는 아직도 올바른 형식이 무엇인지 이해하지 못합니다. . –

답변

0

내가 appbar 그리드 요소의 자식해야한다고 생각하지 않는다 나는 당신이 올바른 형식을 사용하고 있는지 확실하지 않다 appbar에 대한. 올바른 방법은 다음과 유사 할 수 있습니다.

<Page 
    x:Class="MainStream.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:MainStream" 
    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> 
     <Image Grid.RowSpan="2" Stretch="None" Source="/img/sfondo.png" VerticalAlignment="Top" HorizontalAlignment="Center"/> 
     <FlipView x:Name="flipView1" Width="480" Height="270" Margin="0,10,0,0" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1"> 
      <Image Width="480" Height="270" Stretch="UniformToFill"/> 
      <TextBlock FontFamily="Segoe UI" FontSize="26.667" Foreground="#CCFFFFFF" Padding="15,20"/> 
     </FlipView> 
    </Grid> 

    <Page.BottomAppBar> 
     <CommandBar Opacity="1"> 
      <AppBarButton x:Name="AddAppBarButton" Label="add" Icon="Add" /> 
      <CommandBar.SecondaryCommands> 
       <AppBarButton x:Uid="SecondaryButton1" x:Name="SecondaryButton1" Label="secondary command 1" /> 
       <AppBarButton x:Uid="SecondaryButton2" x:Name="SecondaryButton2" Label="secondary command 2" /> 
      </CommandBar.SecondaryCommands> 
     </CommandBar> 
    </Page.BottomAppBar> 

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

     <Page.BottomAppBar> 
      <AppBar VerticalAlignment="Bottom" HorizontalAlignment="Center"> 
      <Grid> 
      <StackPanel Orientation="Horizontal"> 
       <AppBarButton Click="Play_Click" Label="Play" Icon="Play"/> 
       <AppBarButton Click="Pause_Click" Label="Pause" Icon="Pause"/> 
      </StackPanel> 

      <Image Grid.RowSpan="2" Stretch="None" Source="/img/sfondo.png" VerticalAlignment="Top" HorizontalAlignment="Center"/> 
      <FlipView x:Name="flipView1" Width="480" Height="270" Margin="0,10,0,0" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1"> 
       <Image Width="480" Height="270" Stretch="UniformToFill"/> 
       <TextBlock FontFamily="Segoe UI" FontSize="26.667" Foreground="#CCFFFFFF" Padding="15,20"/> 
      </FlipView>  
     </Grid> 
     </AppBar> 
     </Page.BottomAppBar> 

</Page> 

헬퍼 클래스를 수정하십시오. // 다음

App myApp = new App(); 

에서

는 App.xaml 페이지에서 속성에 액세스 할 수있는 올바른 방법이다.

App thisApp = (App)System.Windows.Application.Current; 
+0

AppBar 및 Grid에 2 개의 Markup Error가 있습니다. 어떠한 제안? –

+0

@CinziaNicoletti 무엇이 오류입니까? –

+0

코드를 사용 하시겠습니까? 그는 "content"속성이 두 번 이상 설정되었다고합니다. 그게 무슨 뜻인지 아시오? –

0

는 코드의이 작품 내에서 원하는 일을 시도, 그것은 Page.TopAppBar 또는 Page.BottomAppBar이 될 수 있습니다. 이상이 참조

<Page.TopAppBar> 
<AppBar> 
    <!-- AppBar content --> 
</AppBar> 
</Page.TopAppBar> 

시도 :

adding app bars

+0

이 경우 3 마크 업 오류가 있습니다. page.TopAppBar가 windows phone 8과 호환되지 않을 수도 있습니다. –