How to add a button besides a property in c# code

Grids for WPF Forum

Posted 14 years ago by softeng

Is there any way to add an ellipses button besides a property in c# source code without using xaml? I need to click a button to pop up a window for users to change values for subproperties of that property, but I need to add this button through c# source code.


Comments (1)

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

Again, this depends on how you are using the PropertyGrid, but you can dynamically add "property editors" to the PropertyGrid.PropertyEditors collection. Or you can add entries to the BuiltinEditors.PropertyEditors collection, which will apply your custom property editor to all instances of the PropertyGrid.

The PropertyEditor maps a DataTemplate to a property by name and/or type. The PropertyEditor and DataTemplate can all be created completely in C# code, but you may be able to leverage XAML for defining the DataTemplate (as it's much easier to use/read).

There are several other options available, such as using the EditorAttribute (directly on properties, or via a custom TypeDescriptor or data factory).

If you can be more specific about your setup, we can probably point you in the right direction.

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.