Propertygrid displaying class displayname instead of properties

Hi,

I have a propertygrid that is bound to an object that has 2 classes as properties. The propertygrid is showing the object, but it is not display the properties of these two classes.

In xml I have:

        <syncfusion:PropertyGrid x:Name="ContactDetailPropertyGrid"
                                 Grid.Row="2"
                                 Grid.Column="1"
                                 Margin="5 5 5 5"
                                 DescriptionPanelVisibility="Visible"
                                 SearchBoxVisibility="Visible"
                                 ButtonPanelVisibility="Visible"                                
                                 EnableGrouping="True"
                                 PropertyExpandMode="NestedMode"
                                 SelectedObject="{Binding SelectedPerson}"
                                 SelectedPropertyItem="{Binding SelectedPropertyItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
        </syncfusion:PropertyGrid>

The viewmodel that contains the SelectedPerson is inherited by the viewmodel displaying the propertygrid. SelectedPerson seems to bind and update properly, but the properties remain hidden.

        private object _selectedPerson;
        public object SelectedPerson
        {
            get { return _selectedPerson; }
            set { _selectedPerson = value; NotifyOfPropertyChange(() => SelectedPerson); }
        }


        private PropertyItem selectedPropertyItem;

        public PropertyItem SelectedPropertyItem
        {
            get { return selectedPropertyItem; }
            set
            {
                selectedPropertyItem = value;
                NotifyOfPropertyChange(() => SelectedPropertyItem);
                NotifyOfPropertyChange(() => SelectedPerson);
                //this.RaisePropertyChanged(() => this.SelectedPropertyItem);
            }
        }

I am sure I am overlooking a detail, but I am not sure where to look for a solution anymore. Any suggestion to fix it is appreciated.

Kind regards,

Niels


Attachment: InkedpropertyGrid_LI_7fa56643.7z

17 Replies

NV NM van Strien June 20, 2020 01:44 PM UTC

Dear support team,

I have moved one step closer to a solution. I can now see the properties.
- I add  [TypeConverter(typeof(ExpandableObjects))] above the class that was bound to the propertygrid.
- Also I decorated the class that was bound to the propertygrid with category and property names, as such:
        [CategoryAttribute("Identity")]
        [DisplayNameAttribute("Names")]
        [DescriptionAttribute("Name information of the selected contact.")]

I also found this syntax:
[Display(Description = "Id of the address", GroupName = "Address", AutoGenerateField = true)]

I am unsure which is better. 
- Since I am using Caliburn Micro, I had to make the class inherit from Screen - that made it possible to expand the properties.  See attached screenshot:

Although I can now see and edit my properties
-  I still see some information that I would like to hide (the class information under misc). And also the class displayname is still shown in the grid (see hightlights in the attached image). How do I hide that information?
- Do you have an example that shows how to localize the property grid for different languages - including a localized category attribute?
- Is it possible to expand all properties by default
- Is it possible to search through all properties - also on the properties that are nested in an object?

Kind regards,

Niels van Strien




Attachment: InkedpropertyGrid_LI_426a140.7z


AI Anirudhan Iyyappan Syncfusion Team June 22, 2020 10:35 AM UTC

Hi NM van Strien, 
 
Thank you for contacting Syncfusion support. 
 
Query 1: “The class displayname is still shown in the grid (see hightlights in the attached image). How do I hide that information?” 
 
We have checked your query “Propertygrid displaying class displayname instead of properties” with our sample. but we are unable to replicate this issue in our sample. We suspect that may be cause due to inappropriate binding. So, could use please share us some more information based on this issue such as the Model and ViewModel class or could you please modify the below sample in such a way that issue replicates. So, that we can analyze and let you a solution ASAP. 
 
 
Query 2: “Do you have an example that shows how to localize the property grid for different languages - including a localized category attribute?” 
 
Currently, We are not having the support for localize the PropertyGrid for different languages. The Feature will be included in our upcoming release Volume 2 which will be out by the end of June 2020. 
 
Query 3: “Is it possible to expand all properties by default?” 
 
Yes, we could able to the achieved this requirement in property grid. Please refer to the below KB for further references. 
 

Query 4: “Is it possible to search through all properties - also on the properties that are nested in an object?” 

Yes, we could able to search the property that are listed in the PropertyGrid through the Search Box in the PropertyGrid. 

If we have misunderstood any of your query. Please let us know and share some information based on your requirement, which will be helpful for us to let you know a solution ASAP. 
 
Regards, 
Anirudhan 



NV NM van Strien June 22, 2020 10:57 AM UTC

Hi Anirudhan,

I would be happy to share my code with you, but wonder if it is visible to all people on the forum? Should I worry about that or take any special precautions?

Let me know - I will answer to your other responses shortly.

Niels


NV NM van Strien June 22, 2020 11:12 PM UTC

Hi Anirudhan,

I created a new sample that demonstrates what I am doing. I am using
- MVVM
- Caliburn Micro

This demo shows how I am binding the data to the propertygrid.

- I am looking forward to the upcoming realease with an option to localize the control.

wrt issue 3 - I will look into expanding all properties. I have not had the time to try that.

wrt issue 4. Currently the properties in the nested models are not searchable - try finding callingname - it will not be found. How do I search 1 level deeper?

Thank you for any help you may be able to provide.

Kind regards,

Niels

Attachment: SyncfusionControlsDemo_218f03eb.7z


AI Anirudhan Iyyappan Syncfusion Team June 23, 2020 11:32 AM UTC

Hi NM van Strien, 

Thanks for your update. 

Query 1: “The class displayname is still shown in the grid (see hightlights in the attached image). How do I hide that information?” 
 
In property grid,  By default the property name is displayed in the PropertyGrid . We can change the display name of the properties instead of the property name by using the attributes and event. Please refer to the Ug Document for further references. 


Query 2: “Do you have an example that shows how to localize the property grid for different languages - including a localized category attribute?” 
 
Thanks for your patience, we will let you know once Volume 2 is rolled out. 

Query 3: “Is it possible to expand all properties by default?” 
 
We will wait until we hear from you.  

Query 4: “Is it possible to search through all properties - also on the properties that are nested in an object?”   
 
In PropertyGrid, we could able to search for the properties that expanded on loaded. So, once you expanded all propertied by default then you could able to search. 

Regards, 
Anirudhan 



NV NM van Strien June 23, 2020 03:27 PM UTC

Hi Anirudhan,

I have spent some hours looking for solutions, but am not getting closer I feel.

Query 1: The link shows how to decorate properties in the model that is being displayed in the propertygrid. https://help.syncfusion.com/wpf/propertygrid/displayname
However, the information that I pointed at in my screenshot is 'meta information' about the class and since this is not held in properties in the model, I cannot decorate that information. There is no (explicitly coded) IsInitialized (etc) property in my Model

Query 3:
- I did expand the properties using the example in this link ( https://www.syncfusion.com/kb/11108/how-to-expand-all-nested-level-properties-in-wpf-propertygrid ), but  was hoping not to deviate from the MVMM Pattern. Although the example project suggests that the MVVM pattern was used, in fact to the code to expand the properties is in the code behind file of the View and not in the ViewModel. I have tried, but unfortunately not been able to bind the event handler to the Propertygrid in the ViewModel. Can you perhaps show me how to do that?

Query 4:You wrote: "So, once you expanded all propertied by default then you could able to search. " - but this is not the case. I only can search for the main classes of information.

I attached the demo which now expands all properties by default, after pressing the "Show PropertyGrid" button.

Kind regards,

Niels





Attachment: SyncfusionControlsDemo_bf812507.7z


NV NM van Strien June 24, 2020 09:54 AM UTC

Hi Anirudhan,

I have update my sample
- the propertygrid now only loads after pressing the button on the ribbon, though some visual artifact - very briefly showing the propertygrid - seems to flash at load.
- the code to expand all properties is now in the PropertyGridViewModel - no more code in the PropertyGridView.cs file behind the PropertyGridView.xaml

I was able to make it work by looking at this example: https://www.syncfusion.com/kb/10143/how-to-configure-custom-editors-in-wpf-propertygrid

I also tried to implement the custom editor in that example and although I can create and select a value from the combobox, I have not figured out yet how to update the PropertyGrid with the new Selection.

Query 2 and 3 can be set to 'solved' but, 1 and 4 remain. Also, if you have a suggestion how I can update the PropertyGrid to show the Selected Address in the combobox, I would appreciate it.

This demo may be relevant to anyone using .Net Core 3, MVVM and Caliburn Micro and can easily be extended to include all kinds of SF controls.

Kind regards,

Niels



AI Anirudhan Iyyappan Syncfusion Team June 24, 2020 04:37 PM UTC

Hi NM van Strien, 
 
Thanks for your update. 
 
Currently, we are analyzing your query 1 and 4. We will let you know the further details by June 26th 2020. 
 
Regards, 
Anirudhan 



AI Anirudhan Iyyappan Syncfusion Team June 26, 2020 10:25 AM UTC

Hi NM van Strien, 
 
Thanks for your patience. 
 
Query 1: “The class displayname is still shown in the grid (see hightlights in the attached image). How do I hide that information?” 
 
We could able to the hide the information that are shown the in the grid, through using the below code snippet in your sample. for further reference please refer to the below code snippet and sample below. 
 
Code snippet:  
 
 
public override string ToString() 
{ 
   return ""; 
} 
 
 
 
Query 4: “Is it possible to search through all properties - also on the properties that are nested in an object?” 
 
We have considered your requirement “Unable to search the Nested properties in PropertyGrid”. as a feature request and it will be included in any of our upcoming release. 
 
You can track the status through the following feedback link: 
 
 
We will let you know once feature is implemented. 
 
Regards, 
Anirudhan 



NV NM van Strien June 26, 2020 01:43 PM UTC

Hi Anirudhan,

I will take a look at your solution for Q1 and will let  you know if that solves my question..

With respect to Q4 I wanted to make sure that you noticed that for example in Visual Studio 2019 Community Edition (latest beta), you can set the search depth of the search in a propertygrid (e.g. the locals window during a debugging session). Check the attached screenshot. A similar "search depth" parameter would be a great addition to the syncfusion propertygrid. This information can perhaps be added to the feature request :https://www.syncfusion.com/feedback/15579/unable-to-search-the-nested-properties-in-wpf-propertygrid 

Kind regards,

Niels

Attachment: PropertyGrid_SearchDepth_7002e17c.7z


AI Anirudhan Iyyappan Syncfusion Team June 29, 2020 10:06 AM UTC

Hi NM Van Strien, 
 
Thanks for your update. 
 
Can you please share requirement of using “Search depth” property in PropertyGrid, Because once you can able to search all the Nested properties in PropertyGrid, then what uses cases of “search dept” property? 
 
Regards,  
Anirudhan 



NV NM van Strien June 29, 2020 11:13 AM UTC

Hi Anirudhan,

If you have very complex/large data models, I assume limiting the search depth for properties may result in a performance increase? It is an assumption of mine, but perhaps it could be worthwhile to benchmark performance during development. Please, see it as something for the development team to consider.

Kind regards,

Niels


AI Anirudhan Iyyappan Syncfusion Team June 30, 2020 08:29 AM UTC

Hi NM Van Strien,  
  
Thanks for your update. 

We have informed about the this additional feature request to the development team. We will let you know once feature is implemented.  
  
Regards,  
Anirudhan 



NV NM van Strien July 1, 2020 08:12 AM UTC

Hi Anirudhan,

When I try to download the link Sample: https://www.syncfusion.com/downloads/support/directtrac/155337/ze/SyncfusionControlsDemo478590171  I get a message that this download is not associated with my account. Can you perhaps fix that for me? It was part of your replay on June 26th.

Thank you in advance

Niels


AI Anirudhan Iyyappan Syncfusion Team July 2, 2020 08:24 AM UTC

Hi NM van Strien, 
 
Sorry for the inconvenience. 
 
Please refer to the below Sample link for further references. 
 
 
Regards, 
Anirudhan 



NV NM van Strien July 7, 2020 07:33 PM UTC

Hello,

Congratulations with releasing 2020 Vol 2 of your tools!

It was suggested that PropertyGrid would support localization in Vol 2, but I did not see it as a new feature in the Demo (essential studio samples). Is it functional and if yes, is there a demo?

Kind regards,

Niels van Strien


AI Anirudhan Iyyappan Syncfusion Team July 8, 2020 01:49 PM UTC

Hi NM van Strien, 
 
Thanks for your update. 
 
We have prepared an sample based on your query “how to localize the property grid for different languages”. For further references please refer to the below sample. 
 
 
Regards, 
Anirudhan 


Loader.
Up arrow icon