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
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
Hi Andrew,
Thank you for the quick reply. That is exactly what I was looking for! It solved my problem.
Thank you again,