Xamarin.Forms.Core
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.VisualElement
Xamarin.Forms.ILayout
Xamarin.Forms.IPageController
Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._PageRenderer))
A that occupies the entire screen.
is primarily a base class for more useful derived types. Objects that are derived from the see class are most prominently used as the top level UI element in Xamarin.Forms applications. Typically, application developers will provide such an object to the target platforms by returning it from a static method that the developer created in a project that references . The contents of a typical App.cs file that would appear in a project that reference are shown below:
While a object was returned in the example above, note that any class that extends could have been passed, instead. For example, by using conditional compilation or by checking the platform, the developr can pass a to Windows Phone applications, in order to better match the style of the user interface on that platform, while passing objects or other Page types to the other platforms.
The other projects in the solution that target the Windows Phone, iOS, and Android platforms can call the GetMainPage method to obtain the descendant that describes the portable user interface. This object can then be used with platform-specific static methods or extension methods to incorporate it into the native UI for each platform.
In each platform-specific project, Application developers must call the Xamarin.Forms.Forms.Init() method, with platform-specific parameters, before they get or create any elements.
Each targeted platform uses the returned page in a different way. The Xamarin.Forms.Platform.iOS library provides Xamarin.Forms.Page.CreateViewController() extension method, which returns a UIViewController that application developers can assign to the UIWindow.RootViewController property of the top-level UI. This code is typically placed inside the UIApplicationDelegate.FinishedLaunching override for the main application class. A typical example is shown below:
using System;
using Xamarin.Forms;
namespace MyFirstFormsApp.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
public override bool FinishedLaunching(UIApplication app,
NSDictionary options)
{
Forms.Init();
window = new UIWindow(UIScreen.MainScreen.Bounds);
window.RootViewController = App.GetMainPage().CreateViewController();
window.MakeKeyAndVisible();
return true;
}
}
}
The Xamarin.Forms.Platform.Android.AndroidActivity class provides the Xamarin.Forms.Platform.Android.AndroidActivity.SetPage method, which performs the work that is necessary to make its page argument the top-level UI element of the Xamarin.Forms.Platform.Android.AndroidActivity. A typical example is shown below:
using System;
using Android.App;
using Android.OS;
using Xamarin.Forms.Platform.Android;
namespace MyFirstFormsApp.Android
{
[Activity(Label = "MyFirstFormsApp", MainLauncher = true)]
public class MainActivity : AndroidActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Xamarin.Forms.Forms.Init(this, bundle);
SetPage(App.GetMainPage());
}
}
}
For Windows Phone, provides an extension method for that is called . This method returns a System.Windows.UIElement object that has the page that was passed to it as its current page. A typical example is shown below:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Xamarin.Forms;
namespace MyFirstFormsApp.WinPhone
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
Forms.Init();
Content = Phoneword.App.GetMainPage().ConvertPageToUIElement(this);
}
}
}
In addition to their role as the main pages of applications, objects and their descendants can be used with navigation classes, such as or , among others, to provide rich user experiences that conform to the expected behaviors on each platform.
XAML for Xamarin.Forms supports the following properties for the class:
Property
Value
-
BackgroundImage
A local file specification that identifies an image.
-
Icon
A local file specification that identifies an image.
-
Padding
A comma-separated list of 4 integers that represent a structure.
-
Title
Text that represents the title of the page.
-
ToolbarItems
A list of ToolBarItem elements.
Constructor
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Creates a new element with default values.
To be added.
Field
2.0.0.0
System.String
To be added.
To be added.
Field
2.0.0.0
System.String
To be added.
To be added.
Event
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.EventHandler
Indicates that the is about to appear.
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.String
Identifies the image used as a background for the .
To be added.
To be added.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Identifies the property.
To be added.
Field
2.0.0.0
System.String
To be added.
To be added.
Event
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.EventHandler
Indicates that the is about to cease displaying.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Threading.Tasks.Task<System.String>
System.ParamArray
Title of the displayed action sheet. Must not be .
Text to be displayed in the 'Cancel' button. Can be to hide the cancel action.
Text to be displayed in the 'Destruct' button. Can be to hide the destructive option.
Text labels for additional buttons. Must not be .
Displays a native platform action sheet, allowing the application user to choose from several buttons.
An awaitable Task that displays an action sheet and returns the Text of the button pressed by the user.
To be added.
Method
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Threading.Tasks.Task
The title of the alert dialog.
The body text of the alert dialog.
Text to be displayed on the 'Cancel' button.
Presents an alert dialog to the application user with a single cancel button.
To be added.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Threading.Tasks.Task<System.Boolean>
The title of the alert dialog.
The body text of the alert dialog.
Text to be displayed on the 'Accept' button.
Text to be displayed on the 'Cancel' button.
Presents an alert dialog to the application user with an accept and a cancel button.
To be added.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
Forces the to perform a layout pass.
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.FileImageSource
Resource identifier for the 's associated icon.
To be added.
To be added.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Identifies the property.
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Boolean
Marks the Page as busy. This will cause the platform specific global activity indicator to show a busy state.
A bool indicating if the Page is busy or not.
Setting IsBusy to true on multiple pages at once will cause the global activity indicator to run until both are set back to false. It is the authors job to unset the IsBusy flag before cleaning up a Page.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Identifies the property.
To be added.
Event
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.EventHandler
Raised when the layout of the has changed.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
Left-hand side of layout area.
Top of layout area.
Width of layout area.
Height of layout area.
Lays out children s into the specified area.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
When overridden, allows application developers to customize behavior immediately prior to the becoming visible.
To be added.
Method
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Boolean
Application developers can override this method to provide behavior when the back button is pressed.
To be added.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
Invoked whenever the binding context of the changes. Override this method to add class handling for this event.
Overriders must call the base method.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
To be added.
To be added.
Indicates that the preferred size of a child has changed.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
When overridden, allows the application developer to customize behavior as the disappears.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
Called when the 's property has changed.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
The width allocated to the .
The height allocated to the .
Indicates that the has been assigned a size.
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.Thickness
The space between the content of the and it's border.
To be added.
To be added.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Identifies the property.
To be added.
Method
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Boolean
Calls .
To be added.
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.String
The 's title.
To be added.
To be added.
Field
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
Xamarin.Forms.BindableProperty
Identifies the property.
To be added.
Property
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Collections.Generic.IList<Xamarin.Forms.ToolbarItem>
A set of s, implemented in a platform-specific manner.
To be added.
To be added.
Method
1.0.0.0
1.1.0.0
1.2.0.0
1.3.0.0
1.4.0.0
1.5.0.0
2.0.0.0
System.Void
Requests that the children s of the update their layouts.
To be added.
Property
2.0.0.0
Xamarin.Forms.Rectangle
To be added.
To be added.
To be added.
Property
2.0.0.0
System.Boolean
To be added.
To be added.
To be added.
Property
2.0.0.0
System.Collections.ObjectModel.ObservableCollection<Xamarin.Forms.Element>
To be added.
To be added.
To be added.
Method
2.0.0.0
System.Void
To be added.
To be added.
Method
2.0.0.0
System.Void
To be added.
To be added.