Windows手机创建像Facebook一样的侧面菜单栏

我是Windows Phone 7开发的新手,我正在尝试创建像Facebook上使用的那样的侧面菜单栏。

我创建了usercontrol并为不同的屏幕添加了按钮,我还创建了PhoneApplicationPage并添加了一个按钮。

当我点击该按钮时,它会尝试像菜单栏一样从上到下滑动。

如果我再次点击它,在右上角按钮会隐藏它。

如果有人可以提供帮助,请分享您的代码或示例。

谢谢。

我刚刚为此写了一个完整的解决方案……确实你需要视觉状态! http://depblog.weblogs.us/2013/07/22/facebook-like-settings-pane-windows-phone/

看看SlideView ,被描述为“…导航抽屉的灵感来自Windows Phone上的官方Facebook应用程序。” https://slideview.codeplex.com/

编辑通过nuget的安装包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">           

完成后编辑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在我启动它时崩溃了。 但是当我使用Zumicts Fork of SlideView时,一切都有效,这里有一个nuget包

 Install-Package SlideView.Library.WP81.Zumicts 

有没有人遇到过同样的问题?

那么就像iOS一样,没有一种简单的方法可以做到这一点。 但您可以使用Visual State Manager 。

基本上,塑造比你的舞台更大的屏幕。 然后,您需要创建一个状态,在屏幕中稍微移动屏幕,您可以使用按钮。 你需要在点击方法的按钮上调用状态。

PS:不要使用故事板。 使用状态这是最简单的方法。

尝试像Facebook一样的侧面菜单栏也有手势支持。 试试下面的链接。

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