Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Create an editor for property grid in one project and add refrence to another project

$
0
0
Ok Guys, I have found out why my editor was not being used and maybe this might help someone else who is also suffering from this problem.

In my case I had 3 assemblies:

Assembly A : a C# library assembly where I put my custom property grid Editors (e.g. TestEditor).
Assembly B : a C# library assembly where I put my business objects (e.g. MyClass) that are to be shown in the property grid.
Assembly C : a WPF application that displays a window containing a PropertyGrid control.

So far so good, everything compiles and runs. However, my TestEditor does not end up getting used (instead the default editor is shown). After digging around and looking at the code provided by BoucherS (which helped a huge amount - thanks). I found out what was going wrong. The reason the editor was not getting shown was because of a missing assembly reference.

Assembly B referenced Assembly A because it used the TestEditor in the Editor attribute on one of MyClass's properties.
Assembly C referenced Assembly B because it was showing a MyClass object in the property grid.
But, Assembly C was not referencing Assembly A and for some reason this meant that it could not use the editor.

So the fix was to make sure that the assembly with the property grid (in my case the WPF application) also has a reference to the assembly with the editors.

This is not easy to find when the code compiles and runs and so if there is anything that can be done to help flag this up earlier then that would be appreciated.

Thanks,
Ben

Viewing all articles
Browse latest Browse all 4964


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>