Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
XamPropertyGrid changing property display name after expand
posted

Hello,

we are using XamPropertyGrid with custom property generator.
almost everything is fine but when some property is expanded, the displayname is changing to the propertyname in some cases:

 - if a PropertyGridPropertyItem has one child also expandable - it works ok


 - if there is more chidlren - the display name is changed to propertyname provided in PropertyGridPropertyItem ctor:

our model for which we generate propertygridpropertyitem is:

public interface IPropertyViewModel
{
   string Name { get; }
 
   object Value
   {
      get;
   }
 
   Type ValueType
   {
      get;
   }
 
   ICollection<IPropertyViewModel> Properties { get; }
}

item generation:

return new PropertyGridPropertyItem(propertynameof(IPropertyViewModel.Value), categoryproperty.ValueType, truefalse)
         {
               DisplayName = property.Name
         }

for expandable properties:

var item = new PropertyGridPropertyItem(propertynameof(IPropertyViewModel.Properties), packetDetails.Name, typeof(IPropertyViewModel), truefalse)
                  {
                        DisplayName = property.Name
                  };

Best regards,

Krzysztof