Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
UnboundField to AlternateBinding migration problem when FieldSettings.EditorStyle is set
posted

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

Parents Reply Children
No Data