Nullable DateTime editor and PropertyGrid interop

Editors for WPF Forum

Posted 12 years ago by Evan Phillips
Version: 12.1.0562
Avatar

I just purchased the editors package so we could use it with the Actipro PropertyGrid that we had purchased a while ago.

I was able to get it working fine but have a question about the nullable DateTime editor. When the PropertyGrid first opens, nullable DateTimes display fine and shows that there is no date or time set. However, once the user either enters a date either by hand or by the dropdown date picker, they can not set the date back to null again. They are able to delete the month, day, year, etc. all individually but if you completely delete a value (for example the month), when you start to edit another component of the date (like the day of the month) the value that you tried to delete goes back to its original setting. Aditionally, Ctrl-A only selects the numbers in the current date component that you are editing, so that does not help us either. We really need a way to revert the DateTime back to null in the event of an accidental input.

If it helps, our property editors are set up like so on a single instance of the PropertyGrid:

<propgrid:PropertyGrid.PropertyEditors>
                <propgrid:PropertyEditor ValueTemplateKey="{x:Static propgrid:BuiltinEditors.DynamicStringValueTemplateKey}" />
                <propgrideditors:DateTimePropertyEditor />
                <propgrideditors:NullableDateTimePropertyEditor />
</propgrid:PropertyGrid.PropertyEditors>

 Am I missing something on the control or perhaps a property setting?

Thanks,

Evan Phillips

Comments (2)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Evan,

For the nullable DateTime editor, there is a checkbox on the left.  If you clear that checkbox it will null out the value.  You can see this if you run our Editors' PropertyGrid Integration (Interop) demo.


Actipro Software Support

Posted 12 years ago by Evan Phillips
Avatar

Ah, I see. There is a CheckBoxVisibility property for some (all?) of the editors which apparently was defaulted to false for the nullable DateTime editor. If I set this property to 'Visible' in Xaml the checkbox that you mention appears and allows me to null out the DateTime.

 

Thanks,

Evan

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

Add Comment

Please log in to a validated account to post comments.