New to Telerik UI for Xamarin? Download free 30-day trial

DisplayOptionsAttribute

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

  • Header (string): Sets the label of the respective editor.
  • HeaderResourceKey(string): Sets the key which will be used for globalizing the control´s property headers. The key should be present in a custom RESX file in your application.
  • Group (string): Sets the group which the editor is part of.
  • GroupResourceKey(string): Sets the key which will be used for globalizing the control´s group headers. The key should be present in a custom RESX file in your application.
  • 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.
  • PlaceholderResourceKey(string): Sets the key which will be used for globalizing the placeholder texts of the different properties. The key should be present in a custom RESX file in your application.

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

In this article