[ReadOnly] CheckBox

2 posts, 0 answers
  1. Mikas
    Mikas avatar
    6 posts
    Member since:
    Aug 2016

    Posted 10 Nov Link to this post

    I have the following but it appears the ReadOnly Attribute is ignored?

     

            [DisplayOptions(Position = 3, ColumnPosition = 0, Header = "Completed")]
            [ReadOnly]
            public bool COMPLETED { get; set; }

     

     

  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    488 posts

    Posted 10 Nov Link to this post

    Hello Mike,

    I'm not able to replicate the issue with the provided information.


    Demo

    I have created an example, find it attached. I used the following:

                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
                 x:Class="ReadOnlyProperties.Portable.StartPage">
         
        <Grid>
            <telerikInput:RadDataForm  x:Name="dataForm" />
        </Grid>
    </ContentPage>

    [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
    namespace ReadOnlyProperties.Portable
    {
        public partial class StartPage : ContentPage
        {
            public StartPage()
            {
                InitializeComponent();
     
                dataForm.Source = new Job();
            }
        }
     
        public class Job
        {
            [DisplayOptions(Position = 1, ColumnPosition = 0, Header = "Job Title")]
            public string JobTitle { get; set; }
     
            [DisplayOptions(Position = 2, ColumnPosition = 0, Header = "Job Id")]
            public int JobId { get; set; }
     
            [DisplayOptions(Position = 3, ColumnPosition = 0, Header = "Completed")]
            [ReadOnly]
            public bool COMPLETED { get; set; }
        }
    }


    and result is as expected at runtime, the CheckBox/Swicth is disabled.

    Here is a screenshot of iOS and UWP side-by-side:





    Possible Solution

    The only thing I can think of at this point, is that maybe you recently added the attribute to the class, but the deployed app was using an outdated build of the PCL. Xamarin is known to do this, to see if this is the case, do a clean and rebuild of both PCL and platform projects. Then, redeploy.


    Next Steps

    If that doesn't fix it, please submit a support ticket here with a reproducible so that we can replicate it on our end for further investigation. If it's easier, you can use my demo to replicate it and send us that instead.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top