This project has moved and is read-only. For the latest updates, please go here.

Hide the Object Type (Fully qualified name) for Expandable Object

Aug 1, 2016 at 1:33 PM
Hi,

When we display the expandable objects in the propertygrid the fully qualified name of the expandable object is visible as value. Is there a way to hide the same

eg: In the below scenario when we bind object of type DeviceConfiguration to selectedobject for the property Common the value displayed is MyCompany.Sample.App.Common.

Is there a way to hide the fully qualified name and yet allow the object to be expandable?

namespace MyCompany.Sample.App
{
public class DeviceConfiguration
{
[ExpandableObject]
public CommonDetail Common { get; set; }
}

public class CommonDetail
{
}
}
Aug 1, 2016 at 3:44 PM
Hi,

Yes you can.
In the CommonDetail class, you can overwrite the "ToString()" method to display "nothing" (or any text you want) :
 public class CommonDetail
  {
    public override string ToString()
    {
      return "";
    }
  }
Marked as answer by Pranav_vm on 8/1/2016 at 8:39 PM
Aug 2, 2016 at 4:39 AM
Hi,

Thanks man , it worked like a charm. Had wasted an entire day going through the source provided. Thanks once again :)

Also the propertygrid is awesome. there is only one point which maybe can be taken up in future releases, I had earlier tried ExpandoObject instead of writing own complex classes , but sine expando object cannot reflect types propertygrid would not expand the inner complex types. May be this feature can be added in newer version.

Cheers !!!