Skip to content

Commit 2a54abe

Browse files
authored
Merge pull request xamarin#79 from HankiDesign/patch-5
Improved the Application class remarks
2 parents 6858155 + cc4570e commit 2a54abe

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

docs/Xamarin.Forms/Application.xml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<remarks>
2929
<para>The <see cref="T:Xamarin.Forms.Application" /> class is the core of a Xamarin.Forms application. It sets the root page of the application, persists primitive type data across invocations of the application in the <see cref="P:Xamarin.Forms.Application.Properties" /> dictionary, and provides events to respond to pushing and popping of modal views. Visual studio creates this class for the developer in the appropriate project in a new Xamarin.Forms solution.</para>
3030
<example>
31-
<para>Both Visual Studio for Mac and Visual Studio create a XAML file for the application when the developer creates a Xamarin.Forms solution. The following example code a typical <c>Application</c> class, with an entry in its resource dictionary, from such a XAML file.</para>
31+
<para>Both Visual Studio for Mac and Visual Studio create a XAML and a code-behind file for the application when the developer creates a new Xamarin.Forms solution. The following example shows a typical <c>Application</c> class, with an entry in its resource dictionary.</para>
3232
<code lang="XAML"><![CDATA[
3333
<Application xmlns="http://xamarin.com/schemas/2014/forms"
3434
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
@@ -37,6 +37,32 @@
3737
<Color x:Key="ButtonBackgroundColor">Red</Color>
3838
</Application.Resources>
3939
</Application>]]></code>
40+
<code lang="csharp lang-csharp"><![CDATA[
41+
public partial class App : Application
42+
{
43+
public App()
44+
{
45+
InitializeComponent();
46+
47+
MainPage = new MainPage();
48+
}
49+
50+
protected override void OnStart()
51+
{
52+
// Handle when your app starts
53+
}
54+
55+
protected override void OnSleep()
56+
{
57+
// Handle when your app sleeps
58+
}
59+
60+
protected override void OnResume()
61+
{
62+
// Handle when your app resumes
63+
}
64+
}
65+
]]></code>
4066
</example>
4167
</remarks>
4268
</Docs>

0 commit comments

Comments
 (0)