title: Xamarin.Forms Data Binding to class properties
body: <p>I know that there are a way to bind data of page <code>StackLayout</code> variables to class properties, but unfortunately I don't find any resources about it. I know how to implement simple binding. For example: between <code>Editor</code> and <code>Label</code> . But how can I bind <code>Editor</code> input text to class property ex.: <code>string Number {get; set;}</code> . Here is my class: </p>
  
  <pre><code>public class ThingsObject
      {
          public int Id { get; set; }
          public bool IsStarted { get; set; }
          public string Number {get; set; }
          public string City { get; set; }
          public Zones Zone { get; set; }
          public ContentPage Page;
          public DateTime StartDate { get; set; }
      }
  </code></pre>
  
  <p>And here is my PageLayout class with StackLayout implementation , variables and binding between them.</p>
  
  <pre><code>public partial class ThingPageLayout : CarouselPage
  {
  List&lt;ThingsObject&gt; things= new List&lt;ThingsObject&gt;();
  public ThingPageLayout()
          {
           things.Add(new ThingsObject() { Id = 1, Number = null, City = null, Zone = null });
           foreach (ThingsObject p in things)
              {
                  Children.Add(CreatePage(p));
              }
          }
  public ContentPage CreatePage(ThingsObject thing)
          {
              int uniqueId = this.IdPark;
              var page = new ContentPage()
              {
                  Content = new StackLayout { }
              };
  
              var label1 = new Label
              { 
                  Text = "Text",
                  TextColor = Color.Black,
                  FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                  HorizontalOptions = LayoutOptions.Center
              };
              ((StackLayout)page.Content).Children.Add(label1);
  
              var inputText = new Editor
              {
                  TextColor = Color.Blue,
                  HorizontalOptions = LayoutOptions.Fill,
                  VerticalOptions = LayoutOptions.Fill
              };
              ((StackLayout)page.Content).Children.Add(inputText);
              // Binding here //
              label1.BindingContext = inputText;
              label1.SetBinding(Label.TextProperty, "Text");
              // End of binding //
              var activeButton = new Button
              {
                  ClassId = uniqueId.ToString(),
                  Text = "Button",
                  HorizontalOptions = LayoutOptions.Fill,
                  VerticalOptions = LayoutOptions.Fill
              };
              ((StackLayout)page.Content).Children.Add(activeButton);
              thing.Page = page;
              return page;
          }
  }
  </code></pre>
  
  <p>And here I would like to bind to my existing object <code>things</code> <code>Number</code> to <code>Editor</code> inserted value. Because when projects starts , <code>Number</code> value is <code>null</code>, but after <code>Editor</code> input I want to bind inserted text to my class property <code>Number</code>. </p>