Non Browsable property is stil visible

10 posts, 0 answers
  1. saravanan M
    saravanan M avatar
    2 posts
    Member since:
    Sep 2009

    Posted 28 Sep 2011 Link to this post

    The property is visible in property grid, even after setting the browsable attribute to false.Why?
    public partial class Myobjects : Page
        {
            public Myobjects()
            {
                InitializeComponent();
                radPropertyGrid1.Item = new Customer();
                 
            }
     
            public class Customer
            {
                [Browsable(false)]
                public int Id { get; set; }
                public string Name { get; set; }
            }
        }

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 29 Sep 2011 Link to this post

    Hello Saravanan M,

    In the current version of RadControls, RadPropertyGrid does not respect the Browsable attribute. However, we plan adding support for some attributes (including Browsable) in the future versions. The current recommended approach in scenarios with autogenerated property definitions is to subscribe to RadPropertyGrid's AutoGeneratingPropertyDefinition event, in order to cancel the generation of  any unwanted entries.

    All the best,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 08 Aug 2013 Link to this post

    Hello,

    using the latest internal build (2013.2.805.45) I still face a problem with Browsable.

    I extend a Linq2Sql class like this.

    [MetadataType(typeof(Material.DAMetaData))]
    public partial class Material {
        private void Test() {          
        }
        public class DAMetaData {
            //works
            [Display(Name = "The Name", Order = 1)]
            public object Name { get; set; }
     
            //works
            [Display(Name = "The description", Order = 2)]
            [ReadOnly(true)]
            public object Description2 { get; set; }
     
            //works
            [ReadOnly(true)]
            public object Replaces { get; set; }
     
            //works and does what Browsable(false) should do
            [Display(AutoGenerateField = false)]
            public object Description3 { get; set; }
     
            //NOT working
            [Browsable(false)]
            public object SearchDescription { get; set; }
     
        }
        }


    In the comment I showed what is working an what not.
    Since Display(Autogenerat.... works this is not a big problem. I just wanted to inform you.

    Manfred


  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 09 Aug 2013 Link to this post

    Hello Manfred,

    I have tested the case and Brosable(false) is applied correctly. Will it be possible to check out the sample attached and verify whether I am missing anything ?

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 09 Aug 2013 Link to this post

    Hi Maya,

    YES you missed something in your project.

    First please add a reference to System.ComponentModel.DataAnnotations.
    Next please change the club as follows; (you can copy it there replacing the existing lines).

    ...
    using System.ComponentModel.DataAnnotations;
     
    namespace RadGridView_WPF_AR_16
    {
        /// <summary>
        /// A football club.
        /// </summary>
        [MetadataType(typeof(Club.DAMetaData))]
        public class Club : INotifyPropertyChanged
        {
            public class DAMetaData {
                [Browsable(false)]
                public string Name { get; set; }
                [Display(AutoGenerateField = false)]
                public int StadiumCapacity { get; set; }
            }
     
            public event PropertyChangedEventHandler PropertyChanged;
     
            private string name;
            private DateTime established;
            private int stadiumCapacity;
     
            public string Name
            {
    ...

    I removed Browsable from the Name Property.
    Instead I used a nested Metadata class and applied the Annotations there.

    As I wrote in my first post I have to use this kind of Metadata assignemet since my classes are generated by SQLMetal (linq2sql).
    By the way - your example works in it's original  form.

    Manfred

  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 14 Aug 2013 Link to this post

    Hello Manfred,

    Indeed, you are right - I managed to reproduce the issue and to resolved it. The fix will be available in our internal build coming next Monday. Thank you for reproducing it, I have updated your telerik points accordingly.
      

    Regards,
    Maya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. abdul
    abdul avatar
    7 posts
    Member since:
    Jun 2011

    Posted 17 Jun 2015 in reply to Maya Link to this post

    [Browsable(false)] attribute in MetaDataType class is still not working, i am using your latest build.

    [MetadataType(typeof(Club.DAMetaData))]
    public class Club : INotifyPropertyChanged
    {
         public class DAMetaData {
                [Browsable(false)]
                public string Name { get; set; }
                [Display(AutoGenerateField = false)]
                public int StadiumCapacity { get; set; }
         }
    }

    [MetadataType(typeof(Club.DAMetaData))]   
    public class Club : INotifyPropertyChanged    {      
    public class DAMetaData {           
    [Browsable(false)]           
    public string Name { get; set; }           
    [Display(AutoGenerateField = false)]           
    public int StadiumCapacity { get; set; }      
     }
    }

  9. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 22 Jun 2015 Link to this post

    Hello Abdul,

    I modified the sample previously attached with the latest binaries and the Browsable attribute is respected appropriately. Check out the newly updated project and let me know in case there is some misunderstanding on the issue. 

    Regards,
    Maya
    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
  10. abdul
    abdul avatar
    7 posts
    Member since:
    Jun 2011

    Posted 30 Sep 2015 in reply to Maya Link to this post

    Hello Maya,

    I checked your modified sample, and it is working.

    BUT, in my case it is not working, because I am using multiple objects in property grid.

    you can observe this issue when you will modify your sample as

    <telerik:RadPropertyGrid Item="{Binding Clubs}" PropertySetMode="Intersection" />

    in above change i added PropertySetMode="Intersection" and changed Clubs[0] to Clubs.

    could you plz tell me why MetaData annotation is not working when we use multiple objects with PropertySetMode=Union or Intersection.

     

  11. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 01 Oct 2015 Link to this post

    Hello Abdul,

    Indeed, you are right. I tested the case when working with property sets. I logged the issue in our system for further investigation. You can follow its progress from the Feedback Portal.

    Regards,
    Maya
    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
UI for WPF is Visual Studio 2017 Ready