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
20
Hide fully qualified type name when expanding
posted

Hi, 

I'm using the XamlPropertyGrid in order to show and edit an object's properties. Everything is great, except I would like to perform an additional customization for which I was not able to find a work around.

Basically I would like to hide the fully qualified name of objects when expanding them.

Consider the following example:

namespace this.is.a.very.loooong.namespace

{

 class A { string PropA, int PropB, etc.}

}

namespace some.other.namespace

{

class B{

  string PropX

  ClassA InstanceOfClassA

}

}

When I use the PropertyGrid and try to edit an instance of ClassB and I expand the InstanceOfClassA property, it shows the fully qualified name of the type. I would like to simply show the class name (ClassA instead of the entire "this.is.a.very.loooong.namespace.ClassA".

Is there a way of achieving that?

Thanks, 

Cristian

I'm using version 2018.1 and also a trialed 2019.2

Parents
  • 33370
    Verified Answer
    Offline posted

    Hello Cristian,

    I have been investigating into the behavior you are looking to achieve, and using your example, I would recommend overriding the ToString method of Class A, as what this method returns will be what is shown in the XamPropertyGrid. By default, this method returns the fully qualified type name.

    I am attaching a sample project that demonstrates this. I hope it helps you.

    Please let me know if you have any other questions or concerns on this matter.

    XamPropertyGridQualNameDemo.zip

Reply Children
No Data