6

私は Windows Phone 7 の開発に不慣れで、Facebook で使用されているようなサイド メニュー バーを作成しようとしています。

usercontrolさまざまな画面のボタンを作成して追加しました。ボタンも作成しPhoneApplicationPageて追加しました。

そのボタンをクリックすると、メニューバーのように上から右にスライドしようとします。

もう一度クリックすると、右上のボタンで非表示になります。

誰かが助けてくれる場合は、コードまたは例を共有してください。

ありがとう。

4

4 に答える 4

1

SlideView「... Windows Phone の公式 Facebook アプリに触発されたナビゲーション ドロワー」と説明されている をチェックしてください。https://slideview.codeplex.com/

編集ナゲットのインストールパッケージSlideViewを介してSlideViewをインストールしたら

必要な SlideView を表す UserControl を作成します (LeftView.xaml など)。RightView.xaml など、反対側に別のユーザー コントロールを作成できます。

次に、App.xaml ファイルで、SlideView をリソースとして定義します。

xmlns:slideView="using:SlideView.Library"
xmlns:views="using:SideNav.Views"
xmlns:local="using:SideNav">

<Application.Resources>
    <slideView:SlideApplicationFrame Header="SlideView" Background="White" x:Key="RootFrame" >
        <slideView:SlideApplicationFrame.LeftContent>
            <views:LeftView/>
        </slideView:SlideApplicationFrame.LeftContent>
        <slideView:SlideApplicationFrame.RightContent>
            <views:RightView/>
        </slideView:SlideApplicationFrame.RightContent>
    </slideView:SlideApplicationFrame>
</Application.Resources>

完了したら、App.xaml.cs を編集して、デフォルトの RootFrame と OnLaunchedMethod を変更します。

public sealed partial class App : Application
{
    private TransitionCollection transitions;

    public static SlideApplicationFrame RootFrame { get; private set; }

    protected override void OnLaunched(LaunchActivatedEventArgs e)
    {

        RootFrame = Window.Current.Content as SlideApplicationFrame;

        // 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.Resources["RootFrame"] as SlideApplicationFrame;

            // TODO: change this value to a cache size that is appropriate for your application
            RootFrame.CacheSize = 1;

            // Set the default language
            RootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                // TODO: Load state from previously suspended application
            }

            // Place the frame in the current Window
            Window.Current.Content = RootFrame;
        }

        if (RootFrame.Content == null)
        {
            // Removes the turnstile navigation for startup.
            if (RootFrame.ContentTransitions != null)
            {
                this.transitions = new TransitionCollection();
                foreach (var c in RootFrame.ContentTransitions)
                {
                    this.transitions.Add(c);
                }
            }

            RootFrame.ContentTransitions = null;
            RootFrame.Navigated += this.RootFrame_FirstNavigated;

            // 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), e.Arguments))
            {
                throw new Exception("Failed to create initial page");
            }
        }

        // Ensure the current window is active
        Window.Current.Activate();
    }
}

これでうまくいくはずです。Rightview.xaml と LeftView.xaml にコンテンツを追加するだけです。なんらかの理由で、起動時に WindowsPhone 8.1 xaml がクラッシュしました。しかし、ここでナゲットパッケージとして入手できるSlideViewのZumicts Forkを使用すると、すべてが機能しました

Install-Package SlideView.Library.WP81.Zumicts

誰も同じ問題を経験しましたか?

于 2014-12-28T13:14:01.760 に答える
0

まあ、iOS のようにそれを行う簡単な方法はありません。ただし、 Visual State Managerを使用できます。

基本的には、ステージよりも大きな画面を形作ってください。次に、ステージ内で画面を少し左にシフトし、ボタンを使用できる状態を作成する必要があります。ボタンの on click メソッドで状態を呼び出す必要があります。

PS: 絵コンテは使用しないでください。これを行う最も簡単な方法は、States を使用することです。

于 2013-04-13T07:50:27.173 に答える
0

Facebookのようなサイドメニューバーもジェスチャーサポートで試してみてください。以下のリンクを試してください。

http://developer.nokia.com/community/wiki/Control_animation_while_navigating_between_panes_inside_a_Windows_Phone_page

于 2014-11-03T20:46:37.187 に答える