Default null date for DateTimeEditBox

Editors for WPF Forum

Posted 14 years ago by Dan
Version: 9.1.0507
Right now in my DateTimeEditBox's, if the value of the date/time is null, I have it display "No date/time" by using:

<Style x:Key="DateTimePickerBoxStyle" TargetType="{x:Type editors:DateTimeEditBox}">
<Setter Property="NullContent" Value="No date/time"/>
<Setter Property="Value" Value="{x:Static system:DateTime.Now}"/>

if the user goes to edit the DateTimeEditBox and it's current value is null, it shows up as */*/*. Is there any way to make it so if the user clicks in the text box to edit the text (not clicking the down arrow), that it populates with today's date instead of */*/*, or even just shows up as "mm/dd/yyyy"?

I'm hoping that this can be done in the style like the NullContentProperty above so that it can easily be applied globally to all my DateTimeEditBoxes.

Any suggestions are appreciated. Thanks in advance.


[Modified at 12/04/2009 03:37 PM]

Comments (1)

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

Sorry that's not available at this time, but we may be able to add that feature. I've marked it down on our TODO list, but I'm not sure if it will make it into the next release.

The only work around right now, would be to the handle the IsKeyboardFocusWithinChanged event on the DateTimeEditBox and then set the Value property to Today when it's currently null. You could wrap up that functionality into an attached behavior, and set the attached property that controls the behavior in your implicit Style. That would make it easier to set this globally.

Our Sample Browser has some samples of attached behavior, just search for "behavior'.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.