Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Master Detail Page on the right side using Xamarin.Forms

I've created a master detail page on the left side using Xamarin.Forms, how about creating the same for the right side?

Below is my sample code for the left slider menu;

public class App
{
    static MasterDetailPage MDPage;

    public static Page GetMainPage()
    {
        return MDPage = new MasterDetailPage {
            Master = new ContentPage {
                Title = "Master",
                BackgroundColor = Color.Silver,
                Icon = Device.OS == TargetPlatform.iOS ? "menu.png" : null,
                Content = new StackLayout {
                    Padding = new Thickness(5, 50),
                    Children = { Link("A"), Link("B"), Link("C") }
                },
            },
            Detail = new NavigationPage(new ContentPage {
                Title = "A",
                Content = new Label { Text = "A" }
            }),
        };
    }

    static Button Link(string name)
    {
        var button = new Button {
            Text = name,
            BackgroundColor = Color.FromRgb(0.9, 0.9, 0.9)
        };
        button.Clicked += delegate {
            MDPage.Detail = new NavigationPage(new ContentPage {
                Title = name,
                Content = new Label { Text = name }
            });
            MDPage.IsPresented = false;
        };
        return button;
    }
}
like image 373
ohkered Avatar asked Sep 15 '14 06:09

ohkered


People also ask

How many types of pages are available in Xamarin forms?

Xamarin. Forms provide three common navigation patterns (NavigationPage, TabbedPage, and CarouselPage) for your use.


1 Answers

This does not exists in the Xamarin.Forms controls set, but you can create your own, with renderers for each platform.

You'll find the required information on http://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/

like image 147
Stephane Delcroix Avatar answered Sep 19 '22 10:09

Stephane Delcroix