Advertisement
smeacham

ContentViewDemoVS

May 18th, 2016
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 ContentViewDemoVS
  10. {
  11.     class MyContentPage : ContentPage
  12.     {
  13.         public MyContentPage()
  14.         {
  15.             ContentView contentView = new ContentView
  16.             {
  17.                 BackgroundColor = Color.Accent,
  18.                 Padding = new Thickness(40),
  19.                 HorizontalOptions = LayoutOptions.Fill,
  20.                 Content = new Label
  21.                 {
  22.                     Text = "a view, a layout, or a layout of layouts",
  23.                     FontSize = 20,
  24.                     TextColor = Color.White
  25.                 }
  26.             };
  27.  
  28.             this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
  29.  
  30.             this.Content = new StackLayout
  31.             {
  32.                 Children =
  33.                 {
  34.                     contentView
  35.                 }
  36.             };
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement