private void SetComboBoxConventions() { var conventions = new ComboBoxConventions(); conventions.Register(p => p.Name.EndsWith("CategoryId"), new DotVVM.Framework.Controls.DynamicData.Annotations.ComboBoxSettingsAttribute() { DataSourceBinding = "_root.Categories", DisplayMember = nameof(CategoryBasicDTO.CategoryName), ValueMember = nameof(CategoryBasicDTO.Id), EmptyItemText = "(select category)" }); conventions.Register(p => p.Name.EndsWith("SupplierId"), new DotVVM.Framework.Controls.DynamicData.Annotations.ComboBoxSettingsAttribute() { DataSourceBinding = "_root.Suppliers", DisplayMember = nameof(SupplierBasicDTO.CompanyName), ValueMember = nameof(SupplierBasicDTO.Id), EmptyItemText = "(select supplier)" }); var provider = new ComboBoxConventionFormEditorProvider(conventions); FormEditorProviders.Insert(0, provider); }
public ComboBoxConventionFormEditorProvider(ComboBoxConventions comboBoxConventions) { this.comboBoxConventions = comboBoxConventions; }