PropertyGrid - Custom Editor inside CollectionEditor

Jan 30, 2013 at 9:26 AM


I have a class which I use PropertyGrid in order to edit.

The class I am editing has a Property which is a collection of another class which has a DateTime property.

When editing the collection I am getting the default DateTimeUpDown for the DateTime property (which is really not user friendly, not being able to "type" values in).

I tried to put editor definition as follows (xtpg is namespace of PropertyGrid):


<xtpg:EditorDefinition TargetType="{x:Type sys:DateTime}">
            <xt:DateTimePicker Value="{Binding Value}"/>


But this does not take effect on the embedded property grid in CollectionEditor (and thus, I see DateTimeUpDown).

(It works fine in the main/parent PropertyGrid)

I guess a work around would be to decorate the embedded class DateTime property with custom editor attribute ([Editor(string, string)] but I don't want to do it since the class is defined in external (non-UI) library and I don't want to add reference to the tool kit in it.

Any suggestions/clues?