Hi,
I have an existing UnboundField that is bound to a DateTime and I only want to display the date portion, so I set the EditoryStyle of the Field and set the Mask and Format like the following:
<igDP:UnboundField Name="Date" Label="Date" BindingPath="StartDateTime"> <igDP:UnboundField.Settings> <igDP:FieldSettings> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamDateTimeEditor}"> <Style.Setters> <Setter Property="Mask" Value="{}{date}" /> <Setter Property="Format" Value="{x:Static scsc:DateFormats.DateFormat}" /> </Style.Setters> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:UnboundField.Settings></igDP:UnboundField>
But when I migrate the code to use Infragistics 14.2, and follow the recommendation to change UnboundField to Field with AlternateBinding, the field doesn't show the data any more. If I remove the EditorStyle, then the whole date time shows up, so I know the AlternateBinding is correct. If I change the field to use NameBinding, then the EditorStyle will work. Here's the updated code using AlternateBinding:
<igDP:Field Name="Date" Label="Date" BindingType="UseAlternateBinding" AlternateBinding="{Binding StartDateTime}"> <igDP:Field.Settings> <igDP:FieldSettings> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamDateTimeEditor}"> <Style.Setters> <Setter Property="Mask" Value="{}{date}" /> <Setter Property="Format" Value="{x:Static scsc:DateFormats.DateFormat}" /> </Style.Setters> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings></igDP:Field>
Can you tell me what I did wrong?
As I side note, I need to bind the same DateTime to two separate Fields, one showing just the date portion, and another showing just the time portion. Because Field.Name needs to be unique, I have to use UnboundField (or Field with AlternateBinding).
Thanks for any help!
Harold
Hello Harold,
Thank you for your post.
I have been looking into it and the code snippet that you have provided. I created a sample application based on your scenario and I could not managed to reproduce the behavior that you have described. If you are not able to reproduce the issue with the attached sample application, would you please modify it with the functionality, that you are using, so it reproduces the issue. This way I would be able to further investigate this for you and provide you with more detailed information on this matter.
Looking forward to hearing from you.
Hi Zhivko,
Thanks for the quick response and the sample code. I gave wrong information in my original post. We are binding to a nullable DateTimeOffset, not DateTime. If you change the sample code to use DateTimeOffset or DateTimeOffset?, then the data doesn't show up.
Thanks,