protected virtual async void OnViewModelPropertyChanged(object sender, BindingEventArgs e) { var control = Controls.AsEnumerable().FirstOrDefault(x => x.Name == e.ControlName); if (control == null) { return; } //TODO: throw new MvfException($"Could not bind {e.Property.Name} property because related control is not found"); await BindingDispatcher.BindControl(control, e.Property, e.Converter, e.Type); }
protected virtual async Task InitializeStartupBindings() { foreach (var control in this.Controls.AsEnumerable()) { var controlBindingProperties = this.BindableProperties .Select(x => x.PropertyInfo) .Where(x => x.GetPropertyFromAttribute <MvfBindable, string>(y => y.ControlName) == control.Name) .ToList(); if (!controlBindingProperties.Any()) { continue; } foreach (var bindingProperty in controlBindingProperties) { await BindingDispatcher.BindControl(control, bindingProperty, bindingProperty.GetMvfConverterType()); } } }