Settings_CommandsRequestedで現在のページまたはフレームを取得するにはどうすればよいですか?設定ペインからナビゲートしたい。
1386 次
1 に答える
1
現在Frame
は表示しているものなので、アクセス方法を定義できます。インスタンス参照を静的フィールドとしてAppクラスに保存するか、IoCコンテナーを使用してアクセスできます。これを行う最も簡単な方法は、Appクラスに次の更新を行うことです。
sealed partial class App : Application
{
public static Frame RootFrame { get; private set; }
...
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
Frame rootFrame = this.RootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = this.RootFrame = new Frame();
...
次に、電話App.RootFrame
をかけてフレームを取得します。
于 2013-03-14T17:03:13.773 に答える