2013-04-21 3 views
2

TreeView 컨트롤에 액세스 할 수 있도록 Windows RT XAML Toolkit을 사용하려고합니다.`PageRow '를'WinRTXamlToolkit.Controls.AlternativePage`로 바꿉니다.

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

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> 

    </Grid> 
</Page> 

은 내가 WinRTXamlToolkit.Controls.AlternativePagePage을 변경하려면 :이에 XAML 비슷한 포함하는 MainPage 포함 된 새 BlankApp을 만들었습니다.

<xc:AlternativePage 
    x:Class="BlankApp.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:xc="using:WinRTXamlToolkit.Controls" 
    xmlns:local="using:BlankApp" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"> 

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> 

    </Grid> 
</xc:AlternativePage> 

을 그리고 WinRTXamlToolkit.Controls.AlternativePage보다는 Page을 확장 할 MainPage 클래스를 수정 : 나는 일하기 위해 XAML을 수정했습니다. 내 응용 프로그램을 실행할 때

지금, 그것은 다음과 같은 성명에 실패

 if (rootFrame.Content == null) 
     { 
      // When the navigation stack isn't restored navigate to the first page, 
      // configuring the new page by passing required information as a navigation 
      // parameter 
      if (!rootFrame.Navigate(typeof(MainPage), args.Arguments)) 
      { 
       throw new Exception("Failed to create initial page"); 
      } 
     } 

내가 "초기 페이지를 만들 수 없습니다",하지만 더 자세한 정보를받을 수 있습니다.

내 질문은 다음과 같습니다. 1. Navigate 호출에 실패한 이유에 대한 자세한 내용은 어떻게 확인할 수 있습니까? rootFrame.NavigationFailed += rootFrame_NavigationFailed;을 추가하려고했지만 탐색 실패 이벤트가 발생하지 않는 것 같습니다. 2. WinRTXamlToolkit.Controls.AlternativePage 페이지를 올바르게 사용하려면 어떻게해야합니까?

+0

예외 대화 상자에서 (Ctrl 키-ALT-E는 C 번호 체계를 사용하는 경우), 예외에 휴식을 선택합니다. 거기서보고있는 콜 스택을 게시하십시오. –

+0

@ShaharPrish 나는 모든 예외를 망가뜨릴 수 있도록 설정했습니다. '예외를 던질 때까지 아무 것도 던지지 않습니다 ("초기 페이지를 만들지 못했습니다"); "왜 내가 무슨 일이 일어나는지 알아 내려고 애쓰는 데 어려움을 겪고 있습니다. – Kyle

+0

Windows 런타임 ("WinRT")은 Windows RT와 같지 않습니다. 전자는 개발 아키텍처이고 후자는 Windows 8입니다. – Charles

답변

2

대체 페이지를 사용하는 데 필요한 나머지 변경을 수행 했습니까?

SDK의 샘플 코드를 살펴보십시오. 특히 여기 :

http://winrtxamltoolkit.codeplex.com/SourceControl/changeset/view/379f4af0e5862131aea1992f6875180abeddbcb6#WinRTXamlToolkit.Sample/AppShell.xaml.cs

public sealed partial class AppShell : UserControl 
{ 
    public static AlternativeFrame Frame { get; private set; } 

    public AppShell() 
    { 
     this.InitializeComponent(); 
     Frame = this.RootFrame; 
     this.RootFrame.Navigate(typeof (MainPage)); 
    } 
} 
+0

물론 그렇지 않았습니다! 나는 내가 필요한 변화를 조사 할 때 완전히 그걸 놓쳤다. 일단 AppShell을 작동 시키면됩니다. 감사! – Kyle

관련 문제