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

ReadOnlyAttribute

Properties marked with the ReadOnly attribute will force the RadDataForm to create editors that can not be edited by the end users. There are differences in the behavior of the generated native components in the different platforms:

  • iOS: The editors are in disabled state.
  • Android: Viewers are used instead of editors.

Example

Here is the decoration of the source class properties:

public class Employee
{
    [DisplayOptions(Header = "FirstName")]
    public string FirstName { get; set; } = "John";

    [DisplayOptions(Header = "LastName")]
    public string LastName { get; set; } = "Doe";

    [DisplayOptions(Header = "Manager")]
    [ReadOnly]
    public string Manager { get; set; } = "Michael";
}

And here is the data form setup:

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

See Also

In this article