Customizing a PropertyGrid with/without Reflection

Grids for WPF Forum

Posted 9 years ago by Robert Dyer
Version: 15.1.0621


We really like the default functionality provided by the property grid using reflection, but we need some more customization.

1) For example in a normal text property we want to add a "..." button to bring up a bigger editor with more custom functionality.After researching this I decided this needed to be done without reflection so that we can provide the functionality mentioned above along with other customizations. Was my conclusion correct? Could I instead accomplish this type of thing using reflection?

2) With properties that are actually collections of values, the ActiPro PropertyGrid has a really nice feature to add and remove values when I specify CollectionDisplayMode PropertyGrid dependency property to "EditableInline". With reflection there is hardly any customization allowed here that I could discover such as showing the name of the sub-property rather than just [0], [1], [2], etc. Perhaps there is an attribute to help with this? If there is I would also need a way to specify validation for these sub-property values -- some are text, some are numbers, somre are dates, some are boolean, etc. Without reflection, I may need to implement much functionality myself. To begin with, I would like to use the same green plus "+" and red minus "-" graphic images which are included as resources in one of the ActiPro Dlls. How can I locate those ActiPro images? Is this documented somewhere? For example the ActiPro images for "Pin in" and "Pin out" are located at "pack://application:,,,/ActiproSoftware.Ribbon.Wpf;component/Products/Ribbon/Images/PinIn16.png" and at "pack://application:,,,/ActiproSoftware.Ribbon.Wpf;component/Products/Ribbon/Images/PinIn16.png" respectively. Because my company has licenses to use these Dlls, we can use the images therein -- provided I can find them. 

I am certain there is more custom functionality we will need with this.

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Robert,

1) If you simply want to replace the default text-based property editor, you could make a new DataTemplate in your Application.Resources like:

<DataTemplate x:Key="{x:Static propgridEditors:BuiltinEditors.DynamicValueTemplateKey}">

I believe that is the default one used for strings.  You could clone our default template and add the "..." button into the template.

Could you clarify by what you mean by "using reflection" here?

2) Everything displayed effectively comes from the data accessors, which are generated by the data factory.  The add/remove buttons show when the data accessor's CanAddChild and CanRemove properties respectively are true.  The name comes from the DisplayName of the data accessor, which for collections is returned by .NET property descriptors as [0], [1], etc.  If you create a custom data factory, you can intercept and customize the data accessors that are returned.  The CustomFactory is a good QuickStart for showing a custom data factory.

Actipro Software Support

The latest build of this product (v24.1.2) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.