Custom Ellipsis button without XAML

Grids for WPF Forum

Posted 14 years ago by Nate Smith - Software Engineer, Logical Progression Group
Version: 9.2.0514
Avatar
I am fairly new to using this toolkit so forgive me if this is a silly question, but I cannot seem to figure out how to get a custom editor into my application via code. I am writing a form designer and the property grid will have dozens of different types of data in its 'SelectedItems' collection so I am making heavy use of the [Editor] attribute. Most are working fine, but one class has a Filename (string) property and I would like it to be read-only and need an ellipsis button that fires an OpenFileDialog when clicked. I have inherrited from the DialogTextBoxPropertyEditor:

public class FilenameEditor : DialogTextBoxPropertyEditor
{
    public FilenameEditor()
    {            
    }
}
I have assigned the editor to my Filename property:

[Editor(typeof(FilenameEditor), typeof(PropertyEditor))]
public string Filename
{
    get { return _filename; }
    set { _filename = value; }
}
And when the property is displayed I do get the ellipsis button but it is disabled. I would have expected perhaps an event or an override on the DialogTextBoxPropertyEditor class that I could respond to or override but that doesn't seem to be how it is done. Are there any examples anywhere of this type of implementation?

Thanks!

Comments (1)

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

The Property Editors QuickStart shows how to use the DialogTextBoxPropertyEditor. Basically, you will need to add a handler for the PropertyGrid.ShowPropertyDialogCommand command. This gives you finer control over when it's enabled (and ties into WPF better) versus using an event.


Actipro Software Support

The latest build of this product (v24.1.1) 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.