2

コントロールにアクセスできるように、Windows RT XAML Toolkitを使用しようとしていますTreeView。次のような XAML を含む MainPage を含む新しい BlankApp を作成しました。

<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>

Pageこれをに変更したいWinRTXamlToolkit.Controls.AlternativePage。XAML を次のように変更しました。

<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>

MainPage クラスをWinRTXamlToolkit.Controls.AlternativePageではなく拡張するように変更しましたPage

アプリを起動すると、次のステートメントで失敗します。

        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");
            }
        }

「初期ページの作成に失敗しました」と表示されますが、詳細が表示されません。

Navigate私の質問は次のとおりです。 1.通話が失敗する理由の詳細を確認するにはどうすればよいですか を追加してみましrootFrame.NavigationFailed += rootFrame_NavigationFailed;たが、ナビゲーション失敗イベントが発生していないようです。2. ページを適切に使用するにはどうすればよいWinRTXamlToolkit.Controls.AlternativePageですか?

4

1 に答える 1

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));
    }
}
于 2013-04-21T14:41:12.283 に答える