This is a migrated thread and some comments may be shown as answers.

Non Browsable property is stil visible

9 Answers 117 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
saravanan M
Top achievements
Rank 1
saravanan M asked on 28 Sep 2011, 04:21 PM
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; }
        }
    }

9 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 29 Sep 2011, 08:37 AM
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 >>
0
ManniAT
Top achievements
Rank 2
answered on 08 Aug 2013, 09:36 AM
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


0
Maya
Telerik team
answered on 09 Aug 2013, 08:26 AM
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 >>
0
ManniAT
Top achievements
Rank 2
answered on 09 Aug 2013, 08:58 AM
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

0
Maya
Telerik team
answered on 14 Aug 2013, 10:52 AM
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 >>
0
Abdul
Top achievements
Rank 1
answered on 17 Jun 2015, 10:18 AM

[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; }      
 }
}

0
Maya
Telerik team
answered on 22 Jun 2015, 08:36 AM
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
0
Abdul
Top achievements
Rank 1
answered on 30 Sep 2015, 08:02 AM

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.

 

0
Maya
Telerik team
answered on 01 Oct 2015, 09:59 AM
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
Tags
PropertyGrid
Asked by
saravanan M
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
ManniAT
Top achievements
Rank 2
Maya
Telerik team
Abdul
Top achievements
Rank 1
Share this question
or