DateTimeEditBox: Format property behaves differently from DateTime.ToString( format )

Editors for WPF Forum

Posted 6 years ago by Jiping Zhu (James)
Version: 13.1.0582
Platform: Silverlight Controls
Environment: Windows 7 (64-bit)
Avatar

Hello guys,

In our application, a user can define a date time format that is used for both display and edit.

In display scenario, we use DateTime.ToString( format )

In edit scenario, we set DateTimeEditBox.Format = format

We start to notice inconsistent behaviors when format contains escaped symbols in literal:

 

E.g. (presuming current culture is En-AU)


1. DateTime behavior:

Code:

DateTime.Now.ToString(@"dd-MM-yyyy 'my \'special\' date'")

 

Output:

25-07-2013 my 'special' date

 

2. DateTimeEditBox behavior:

Code:

            <editors:DateTimeEditBox x:Name="editBox"
                                     Width="200"
                                     Margin="0,7,0,0"
                                     HorizontalAlignment="Left"
                                     Format="dd-MM-yyyy 'a \'special\' date'"
                                     Value="{x:Static system:DateTime.Today}">
                <editors:DateTimeEditBox.LayoutTransform>
                    <ScaleTransform ScaleX="{Binding ElementName=scaleSlider, Path=Value}" ScaleY="{Binding ElementName=scaleSlider, Path=Value}" />
                </editors:DateTimeEditBox.LayoutTransform>
            </editors:DateTimeEditBox>

 

DateTimeEditBox.DateValue binds to DateTime.Now

Output:

25-07-2013 a \0pecial' 25aAe'

Note how the first backslash is treated as a literal character rather than an escape character, and that the first escaped single quote is treated as a closing quote rather than a literal.

 

Is this a problem in DateTimeEditBox formatting?

Comments (1)

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

Hello,

Thanks for reporting this.  We will update our code for the 2013.2 version to handle the escapes properly.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 11 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.