protected override void OnAttachedTo(ContentPage bindable) { dataForm = bindable.FindByName <Syncfusion.XForms.DataForm.SfDataForm>("dataForm"); dataForm.LayoutManager = new DataFormLayoutManagerExt(dataForm); contactLabel = bindable.FindByName <Button>("contactLabel"); editAndDoneButton = bindable.FindByName <Button>("editButton"); dataForm.BindingContextChanged += OnBindingContextChanged; viewModel = bindable.BindingContext as ListViewGroupingViewModel; dataForm.AutoGeneratingDataFormItem += OnAutoGeneratingDataFormItem; dataForm.Validating += OnValidating; base.OnAttachedTo(bindable); }
private void OnBindingContextChanged(object sender, EventArgs e) { viewModel = dataForm.BindingContext as ListViewGroupingViewModel; viewModel.RefreshLayout = false; viewModel.IsVisible = true; if (viewModel.IsNewContact) { dataForm.IsReadOnly = false; contactLabel.Text = "Add Contact"; viewModel.IsNewContact = false; editAndDoneButton.Text = "Done"; } }