DisplayOptionsAttribute

The DisplayOptionsAttribute controls the way an editor is presented. It provides the following properties:

  • Header (string): Sets the label of the respective editor.
  • Group (string): Sets the group which the editor is part of.
  • Position (int): Sets the position of the editor in the layout.
  • ColumnPosition (int): Sets the column position of the editor in the layout.
  • ColumnSpan (int): Sets the column span of the editor in the layout.
  • PlaceholderText (string): Sets the empty content of the editor.

All properties are optional.

Example

Here is the decoration of the source class:

public class Person
{
    [DisplayOptions(Header = "FirstName", PlaceholderText = "first name", Group = "Public Info")]
    public string FirstName { get; set; } = "Peter";

    [DisplayOptions(Header = "LastName", PlaceholderText = "last name", Group = "Public Info")]
    public string LastName { get; set; } = "Pan";

    [DisplayOptions(Header = "Age", PlaceholderText = "age", Group = "Private Info")]
    public int Age { get; set; } = 13;

    [DisplayOptions(Header = "Weight", PlaceholderText = "weight", Group = "Private Info")]
    public double Weight { get; set; } = 48;
}

And here is the data form setup:

var dataForm = new RadDataForm
{
    Source = new Person()
};

dataForm.RegisterEditor("Weight", EditorType.DecimalEditor);
dataForm.RegisterEditor("Age", EditorType.IntegerEditor);

See Also