/// <inheritdoc/> protected override EntityProperty GenerateEntityProperty(object property) { var column = this.Columns.FirstOrDefault(a => a is DataGridTypedColumn && ((DataGridTypedColumn)a).PropertyName.Equals(((PropertyInfo)property).Name)); var entityProperty = new GridFormEntityProperty((PropertyInfo)property, this.Context, column); entityProperty.PopulatePropertyMetadata(); return(entityProperty); }
/// <inheritdoc/> public override Entity GenerateEntity() { Entity entity = new Entity(); var properties = this.GetProperties(); foreach (var property in properties) { if (!this.ShouldGenerateEntityProperty(property)) { continue; } GridFormEntityProperty entityProperty = this.GenerateEntityProperty(property) as GridFormEntityProperty; foreach (var column in this.Columns) { var comboColumn = column as DataGridComboBoxColumn; if (comboColumn != null) { if (entityProperty.PropertyName.Equals(comboColumn.PropertyName)) { entityProperty.DisplayMemberPath = comboColumn.DisplayMemberPath; entityProperty.SelectedValuePath = comboColumn.SelectedValuePath; if (!string.IsNullOrEmpty(comboColumn.ItemsSourcePath)) { var info = this.Context.GetType().GetRuntimeProperty(comboColumn.ItemsSourcePath); entityProperty.ValueOptions = info.GetMethod.Invoke(this.Context, new object[0]) as IList; } else { entityProperty.ValueOptions = comboColumn.ItemsSource as IList; } } } } entity.Properties.Add(entityProperty); } entity.Validator = this.GetItemValidator(entity); this.Entity = entity; return(entity); }