/// <summary>
 /// Attaches to the superclass and then calls the OnAttachedTo method on this object.
 /// </summary>
 /// <param name="bindable">The bindable object to which the behavior was attached.</param>
 protected override void OnAttachedTo(ContentPage bindable)
 {
     this.dataForm = bindable.FindByName <Syncfusion.XForms.DataForm.SfDataForm>("dataForm");
     this.dataForm.LayoutManager          = new DataFormLayoutManagerExt(this.dataForm);
     this.contactLabel                    = bindable.FindByName <Button>("contactLabel");
     this.editAndDoneButton               = bindable.FindByName <Button>("editButton");
     this.dataForm.BindingContextChanged += this.OnBindingContextChanged;
     this.viewModel = bindable.BindingContext as ContactListViewModel;
     this.dataForm.AutoGeneratingDataFormItem += this.OnAutoGeneratingDataFormItem;
     this.dataForm.Validating += this.OnValidating;
     base.OnAttachedTo(bindable);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Occurs when Binding context of the data form is changed.
 /// </summary>
 /// <param name="sender">Sender object.</param>
 /// <param name="e">Event arguments of binding context changed event.</param>
 private void OnBindingContextChanged(object sender, EventArgs e)
 {
     this.viewModel = this.dataForm.BindingContext as ContactListViewModel;
     this.viewModel.RefreshLayout = false;
     this.viewModel.IsVisible     = true;
     if (this.viewModel.IsNewContact)
     {
         this.dataForm.IsReadOnly    = false;
         this.contactLabel.Text      = "Add Contact";
         this.viewModel.IsNewContact = false;
         this.editAndDoneButton.Text = "Done";
     }
 }