The game was made using the program Construct 3, included capx file. Use the most stable version of the program. If you want to edit the game, you will need to have a license of the program. But to edit the images, just replace them. Features: Full Game; HTML5 Mobile Optimized; Mobile App Optimized Cocoon.io; Facebook Share.
-->The Xamarin.Forms MasterDetailPage is a page that manages two related pages of information – a master page that presents items, and a detail page that presents details about items on the master page. This article explains how to use a MasterDetailPage and navigate between its pages of information.
Overview
A master page typically displays a list of items, as shown in the following screenshots:
The location of the list of items is identical on each platform, and selecting one of the items will navigate to the corresponding detail page. In addition, the master page also features a navigation bar that contains a button that can be used to navigate to the active detail page:
- On iOS, the navigation bar is present at the top of the page and has a button that navigates to the detail page. In addition, the active detail page can be navigated to by swiping the master page to the left.
- On Android, the navigation bar is present at the top of the page and displays a title, an icon, and a button that navigates to the detail page. The icon is defined in the
[Activity]
attribute that decorates theMainActivity
class in the Android platform-specific project. In addition, the active detail page can be navigated to by swiping the master page to the left, by tapping the detail page at the far right of the screen, and by tapping the Back button at the bottom of the screen. - On the Universal Windows Platform (UWP), the navigation bar is present at the top of the page and has a button that navigates to the detail page.
A detail page displays data that corresponds to the item selected on the master page, and the main components of the detail page are shown in the following screenshots:
The detail page contains a navigation bar, whose contents are platform-dependent:
- On iOS, the navigation bar is present at the top of the page and displays a title, and has a button that returns to the master page, provided that the detail page instance is wrapped in the
NavigationPage
instance. In addition, the master page can be returned to by swiping the detail page to the right. - On Android, a navigation bar is present at the top of the page and displays a title, an icon, and a button that returns to the master page. The icon is defined in the
[Activity]
attribute that decorates theMainActivity
class in the Android platform-specific project. - On UWP, the navigation bar is present at the top of the page and displays a title, and has a button that returns to the master page.
Navigation Behavior
The behavior of the navigation experience between master and detail pages is platform dependent:
- On iOS, the detail page slides to the right as the master page slides from the left, and the left part of the detail page is still visible.
- On Android, the detail and master pages are overlaid on each other.
- On UWP, the master page slides from the left over part of the detail page, provided that the
MasterBehavior
property is set toPopover
. For more information, see Controlling the Detail Page Display Behavior.
Similar behavior will be observed in landscape mode, except that the master page on iOS and Android has a similar width as the master page in portrait mode, so more of the detail page will be visible.
For information about controlling the navigation behavior, see Controlling the Detail Page Display Behavior.
Creating a MasterDetailPage
A MasterDetailPage
contains Master
and Detail
properties that are both of type Page
, which are used to get and set the master and detail pages respectively.
Best Xamarin Apps
Important
A MasterDetailPage
is designed to be a root page, and using it as a child page in other page types could result in unexpected and inconsistent behavior. In addition, it's recommended that the master page of a MasterDetailPage
should always be a ContentPage
instance, and that the detail page should only be populated with TabbedPage
, NavigationPage
, and ContentPage
instances. This will help to ensure a consistent user experience across all platforms.
The following XAML code example shows a MasterDetailPage
that sets the Master
and Detail
properties:
The following code example shows the equivalent MasterDetailPage
created in C#:
The MasterDetailPage.Master
property is set to a ContentPage
instance. The MasterDetailPage.Detail
property is set to a NavigationPage
containing a ContentPage
instance.
Creating the Master Page
The following XAML code example shows the declaration of the MasterPage
object, which is referenced through the MasterDetailPage.Master
property:
Images For Slot Machine Xamarin App Free
The page consists of a ListView
that's populated with data in XAML by setting its ItemsSource
property to an array of MasterPageItem
instances. Each MasterPageItem
defines Title
, IconSource
, and TargetType
properties.
Xamarin Image Control
A DataTemplate
is assigned to the ListView.ItemTemplate
property, to display each MasterPageItem
. The DataTemplate
contains a ViewCell
that consists of an Image
and a Label
. The Image
displays the IconSource
property value, and the Label
displays the Title
property value, for each MasterPageItem
.
The page has its Title
and IconImageSource
properties set. The icon will appear on the detail page, provided that the detail page has a title bar. This must be enabled on iOS by wrapping the detail page instance in a NavigationPage
instance.
Note
The MasterDetailPage.Master
page must have its Title
property set, or an exception will occur.
The following code example shows the equivalent page created in C#:
The following screenshots show the master page on each platform:
Creating and Displaying the Detail Page
The MasterPage
instance contains a ListView
property that exposes its ListView
instance so that the MainPage
MasterDetailPage
instance can register an event-handler to handle the ItemSelected
event. This enables the MainPage
instance to set the Detail
property to the page that represents the selected ListView
item. The following code example shows the event-handler:
The OnItemSelected
method performs the following actions:
- It retrieves the
SelectedItem
from theListView
instance, and provided that it's notnull
, sets the detail page to a new instance of the page type stored in theTargetType
property of theMasterPageItem
. The page type is wrapped in aNavigationPage
instance to ensure that the icon referenced through theIconImageSource
property on theMasterPage
is shown on the detail page in iOS. - The selected item in the
ListView
is set tonull
to ensure that none of theListView
items will be selected next time theMasterPage
is presented. - The detail page is presented to the user by setting the
MasterDetailPage.IsPresented
property tofalse
. This property controls whether the master or detail page is presented. It should be set totrue
to display the master page, and tofalse
to display the detail page.
The following screenshots show the ContactPage
detail page, which is shown after it's been selected on the master page:
Controlling the Detail Page Display Behavior
How the MasterDetailPage
manages the master and detail pages depends on whether the application is running on a phone or tablet, the orientation of the device, and the value of the MasterBehavior
property. This property determines how the detail page will be displayed. It's possible values are:
- Default – The pages are displayed using the platform default.
- Popover – The detail page covers, or partially covers the master page.
- Split – The master page is displayed on the left and the detail page is on the right.
- SplitOnLandscape – A split screen is used when the device is in landscape orientation.
- SplitOnPortrait – A split screen is used when the device is in portrait orientation.
The following XAML code example demonstrates how to set the MasterBehavior
property on a MasterDetailPage
:
The following code example shows the equivalent MasterDetailPage
created in C#:
However, the value of the MasterBehavior
property only affects applications running on tablets or the desktop. Applications running on phones always have the Popover behavior.
Summary
Images For Slot Machine Xamarin Apps
This article demonstrated how to use a MasterDetailPage
and navigate between its pages of information. The Xamarin.Forms MasterDetailPage
is a page that manages two pages of related information – a master page that presents items, and a detail page that presents details about items on the master page.