0

私はメトロ スタイル アプリに MVVM Light Framework を使用しています。

Aboutページを表示するコマンドをSettingsPaneに追加したい。アバウト ページは右側に表示されます (プリインストールされたカレンダー アプリのように)。テストのために、App.xaml.cs の OnLaunched メソッドに次の行を追加しました。

SettingsPane.GetForCurrentView().CommandsRequested += App_CommandsRequested;

および次のイベント ハンドラー:

void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
    // Add an About command
    var about = new SettingsCommand("about", "About", (handler) =>
    {
        // show about page in flyout transition...
    });

    args.Request.ApplicationCommands.Add(about);
}

これが唯一の方法ですか?About ページをフライアウトするにはどうすればよいですか? 任意のヒント...?

手伝ってくれてありがとう!マイケル

4

2 に答える 2

2

最初の質問に答えるために:
私の知る限り、これはそのようなことを行う唯一の方法です.

2 番目の質問に答えるには:
about ページをフライアウトするには、次のようにします。

// Add an About command
var about = new SettingsCommand("about", "About", (handler) =>
{
    // show about page in flyout transition...
    var currentPane = new AboutPane(); // the aboutpane is a page
    var myPopup = new Popup();

    myPopup.IsLightDismissEnabled = true;
    myPopup.Width = _settingsWidth;
    myPopup.Height = Window.Current.Bounds.Height;

    myPopup.Width = 346;
    myPopup.Height = Window.Current.Bounds.Height;

    myPopup.Child = currentPane;
    myPopup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - 346);
    myPopup.SetValue(Canvas.TopProperty, 0);
    myPopup.IsOpen = true;
});

args.Request.ApplicationCommands.Add(about);

これで問題が解決することを願っています。

于 2012-07-06T12:41:30.613 に答える
1

マイケル、 githubの Callisto プロジェクトの SettingsFlyout コントロールを使ってみてください

次のようなものが必要になります。

using Callisto.Controls;

//... other code here

//in your callback for handling the settings command:

// show about page in flyout transition...
var settingsFlyout = new SettingsFlyout();
settingsFlyout.Content = new AboutControl(); //this would be your own user control that contains the about page content

settingsFlyout.IsOpen = true;
于 2012-06-14T00:27:50.947 に答える