private void View_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(Label): this.Label = AtomForm.GetLabel(Content); UpdateCell(); break; case nameof(LabelColor): this.LabelColor = AtomForm.GetLabelColor(Content); UpdateCell(); break; case nameof(Error): this.Error = AtomForm.GetError(Content); UpdateCell(); break; case nameof(Description): this.Description = AtomForm.GetDescription(Content); UpdateCell(); break; case nameof(IsRequired): this.IsRequired = AtomForm.GetIsRequired(Content); UpdateCell(); break; case nameof(Content): UpdateCell(); break; } }
/// <summary> /// /// </summary> /// <param name="view"></param> public void BindView(View view) { this.Content = view; view.PropertyChanged += View_PropertyChanged; Label = AtomForm.GetLabel(view); this.LabelColor = AtomForm.GetLabelColor(view); this.Error = AtomForm.GetError(view); this.Description = AtomForm.GetDescription(view); this.IsRequired = AtomForm.GetIsRequired(view); this.UpdateCell(); }
/// <summary> /// /// </summary> /// <param name="view"></param> public void BindView(View view) { this.Content = view; if (view == null) { return; } view.SetBinding(BindingContextProperty, new Binding { Path = "BindingContext", Source = this.Form }); view.PropertyChanged += View_PropertyChanged; Label = AtomForm.GetLabel(view); this.LabelColor = AtomForm.GetLabelColor(view); this.Error = AtomForm.GetError(view); this.Description = AtomForm.GetDescription(view); this.IsRequired = AtomForm.GetIsRequired(view); this.SetBinding(IsVisibleProperty, new Binding { Path = "IsVisible", Source = view }); this.lastDisposable.SetTarget(AtomFieldRenderer.BindKeyboardActions(view)); this.UpdateCell(); }