Advertisement
smeacham

Untitled

May 17th, 2016
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. using Xamarin.Forms;
  8.  
  9. namespace Exercise4_2
  10. {
  11.     class MyContentPage : ContentPage
  12.     {
  13.         public MyContentPage ()
  14.         {
  15.             AbsoluteLayout absoluteLayout = new AbsoluteLayout
  16.             {
  17.                 VerticalOptions = LayoutOptions.FillAndExpand
  18.             };
  19.  
  20.             Label centeredLabel = new Label
  21.             {
  22.                 Text = "Hello, World!"
  23.             };
  24.  
  25.             absoluteLayout.Children.Add(centeredLabel);
  26.             AbsoluteLayout.SetLayoutFlags(
  27.                 centeredLabel,
  28.                 AbsoluteLayoutFlags.PositionProportional);
  29.             AbsoluteLayout.SetLayoutBounds(
  30.                 centeredLabel,
  31.                 new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
  32.  
  33.             this.Content = absoluteLayout;
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement