Static properties

Grids for WPF Forum

Posted 13 years ago by KC
Version: 11.1.0542
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 13 years ago by Actipro Software Support - Cleveland, OH, USA
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 (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.