protected override GridViewColumn CreateColumnCore(GridView gridView, PropertyDisplayMetadata property, DynamicDataContext context) { var column = new GridViewTextColumn(); column.ValueType = TextBoxHelper.GetValueTypeOrDefault(property.PropertyInfo); column.FormatString = property.FormatString; column.SetBinding(GridViewTextColumn.ValueBindingProperty, context.CreateValueBinding(property.PropertyInfo.Name)); column.IsEditable = property.IsEditAllowed; return(column); }
public override void CreateControl(DotvvmControl container, PropertyDisplayMetadata property, DynamicDataContext context) { if (!property.IsEditAllowed) { var literal = new Literal(); container.Children.Add(literal); literal.SetBinding(Literal.TextProperty, context.CreateValueBinding(property.PropertyInfo.Name)); return; } var textBox = new TextBox(); container.Children.Add(textBox); var cssClass = ControlHelpers.ConcatCssClasses(ControlCssClass, property.Styles?.FormControlCssClass); if (!string.IsNullOrEmpty(cssClass)) { textBox.Attributes["class"] = cssClass; } textBox.ValueType = TextBoxHelper.GetValueTypeOrDefault(property.PropertyInfo); textBox.FormatString = property.FormatString; textBox.SetBinding(TextBox.TextProperty, context.CreateValueBinding(property.PropertyInfo.Name)); if (property.DataType == DataType.Password) { textBox.Type = TextBoxType.Password; } else if (property.DataType == DataType.MultilineText) { textBox.Type = TextBoxType.MultiLine; } if (textBox.IsPropertySet(DynamicEntity.EnabledProperty)) { ControlHelpers.CopyProperty(textBox, DynamicEntity.EnabledProperty, textBox, TextBox.EnabledProperty); } }