Introducing
Your new presentation assistant.
Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.
Trending searches
MasterDetail and Navigation Pages
Manages two separate panes, which includes a flyout control.
<MasterDetailPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MasterDetailPageNavigation;assembly=MasterDetailPageNavigation"
x:Class="MasterDetailPageNavigation.MainPage" >
<MasterDetailPage.Master>
<local:MasterPage x:Name="masterPage" />
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<local:ContactsPage />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
https://github.com/jjcaicedob/Xamarin/blob/master/AppNavigation/AppNavigation/AppNavigation/TestMasterDetailPage.xaml
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="using:MasterDetailPageNavigation"
x:Class="MasterDetailPageNavigation.MasterPage"
Padding="0,40,0,0"
Icon="hamburger.png"
Title="Personal Organiser" >
<StackLayout>
<ListView x:Name="listView">
<ListView.ItemsSource>
<x:Array Type="{x:Type local:MasterPageItem}">
<local:MasterPageItem Title="Contacts" IconSource="contacts.png" TargetType="{x:Type local:ContactsPage}" />
<local:MasterPageItem Title="TodoList" IconSource="todo.png" TargetType="{x:Type local:TodoListPage}" />
<local:MasterPageItem Title="Reminders" IconSource="reminders.png" TargetType="{x:Type local:ReminderPage}" />
</x:Array>
</ListView.ItemsSource>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Image Source="{Binding IconSource}" />
<Label Grid.Column="1" Text="{Binding Title}" />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackLayout>
</ContentPage >
https://github.com/jjcaicedob/Xamarin/blob/master/AppNavigation/AppNavigation/AppNavigation/TestMasterDetailPageMaster.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AppNavigation.TestMasterDetailPageDetail"
Title="Contact Page">
<StackLayout Padding="10">
<Label Text="This is a detail page."/>
</StackLayout>
</ContentPage >
https://github.com/jjcaicedob/Xamarin/blob/master/AppNavigation/AppNavigation/AppNavigation/TestMasterDetailPageDetail.xaml
The MasterDetailPage is a page that manages two related pages of information:
The behavior of the navigation experience between master and detail pages is platform dependent:
Provides the infrastructure for navigating among pages.
To move from one page to another, an application will push a new page onto the navigation stack, where it will become the active page, as shown in the following diagram:
To return back to the previous page, the application will pop the current page from the navigation stack, and the new topmost page becomes the active page, as shown in the following diagram:
The following screenshots show the main components of the NavigationPage on each platform:
The layout of a NavigationPage is dependent on the platform:
The first page added to a navigation stack is referred to as the root page of the application, and the following code example shows how this is accomplished:
The RootPage property of a NavigationPage instance provides access to the first page in the navigation stack.
public App ()
{
MainPage = new NavigationPage (new Page1Xaml ());
}
To navigate to Page2Xaml, it is necessary to invoke the PushAsync method on the Navigation property of the current page, as demonstrated in the following code example:
When the PushAsync method is invoked, the following events occur:
async void OnNextPageButtonClicked (object sender, EventArgs e)
{
await Navigation.PushAsync (new Page2Xaml ());
}
The active page can be popped from the navigation stack by pressing the Back button on the device, regardless of whether this is a physical button on the device or an on-screen button.
When the PopAsync method is invoked, the following events occur:
async void OnPreviousPageButtonClicked (object sender, EventArgs e)
{
await Navigation.PopAsync ();
}