Search code examples
androidxamarinwindows-phone-8xamarin.forms

Xamarin.Forms Slider menu


I'm working on an app that must work on Android and WinPhone. The screen design requires a slider menu. I've implemented that according some examples I've found.

var listMenu = new ObservableCollection<MenuItemAbstract>() {new MyMenu()};
return  new NavigationPage(new RootPage("MainPage", Strings.Version, listMenu, new MainPage(), false)) {BarBackgroudColor = Colours.ActionBarBackground, BarTextColor = Colours.ActionBarText};

My problem is, on Android it works fine (it is a slider menu), but on Windows Phone it looks like tabs on the screen bottom.

Is there a way to make my menu look like same slider as on Android?


Solution

  • I assume that the tabs at the screen bottom that you refer to is the Windows Phone standard menu. The reason this happens is because Xamarin tries to use native components - and on Windows Phone these menues are the standard, and they follow design guidelines. Normally this should be fine. Keep your application familiar for the users - an iOS interface on a WindowsPhone app is generally not a good idea unless you have a very very good UI (Spotify is a great example of this).

    Theres, to my knowledge, no current supported way for slide-in menus in WindowsPhone, so you would have to make this custom yourself. In Xamarin.Forms you would have to do this using the DependencyManager. Explanation and examples can be found here: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/dependency-service/ and here http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/files/ (this one is coined towards working with files, but just replace the files-part with your menu part, and the way to set it up is identical)

    If it's a "normal" Xamarin project, then it's just the WinPhone8 SDK you program towards anyway - and you could have to do some separate research as to how to implement a slide-in menu in Windows Phone.

    Maybe this is a good start? http://depblog.weblogs.us/2013/07/30/facebook-like-settings-pane-with-gestures-windows-phone/