smeacham

HomePage.cs

May 27th, 2016
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using Xamarin.Forms;
  2.  
  3. namespace NavigationDemoVS
  4. {
  5.     internal class HomePage : ContentPage
  6.     {
  7.         Button homeButton;
  8.  
  9.         public HomePage()
  10.         {
  11.             Title = "Hierarchical Navigation";
  12.  
  13.             Label homeLabel = new Label
  14.             {
  15.                 Text = "Home Page",
  16.                 FontSize = 40
  17.             };
  18.  
  19.             homeButton = new Button
  20.             {
  21.                 Text = "Go to Second Page"
  22.             };
  23.  
  24.             homeButton.Clicked += async (sender, args) =>
  25.                 await Navigation.PushAsync(new secondPage());
  26.  
  27.             StackLayout stackLayout = new StackLayout
  28.             {
  29.                 Children = { homeLabel, homeButton }
  30.             };
  31.  
  32.             this.Content = stackLayout;
  33.         }
  34.     }
  35. }
Add Comment
Please, Sign In to add comment