Static properties

Grids for WPF Forum

Posted 8 years ago by KC
Version: 11.1.0542
Avatar
Is there a reason why Shared (or Static) properties would not appear in the property grid after setting the SelectedObject to a class that contained shared properties? The Public properties (that are not shared) do appear. If a shared property is changed to just public it works.

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi KC,

In general, PropertyGrids only show instance properties, not static properties. It can get confusing to end-users if static properties are shown, and they switch between two objects which share properties (as changing a static property on one would affect the other).

By default, our PropertyGrid uses the .NET TypeDescriptor to determine what to show. The built-in TypeDescriptors only expose instance properties, but you can customize this. You can implement ICustomTypeDescriptor on your object and add any static properties via the GetProperties methods. Most of the methods can simply delegate their call to TypeDescriptor.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 10 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.