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
560
Validation Grid Column InvalidValueBehavior in Xaml
posted

Hi,

How to set Invalid Value Behavior for a column in Xaml. InvalidValueBehavior set below does not work. I am being forced to handle event EditModeValidationError.

<igDP:UnboundField BindingPath="ColumnValue" BindingMode="TwoWay" Name="Depot" Label="XColumn" Visibility="Visible">
<igDP:Field.Settings>
    <igDP:FieldSettings CellMinWidth="75" CellMaxWidth="75" CellWidth="75" EditAsType="{x:Type sys:String}">
 <igDP:FieldSettings.EditorStyle>
     <Style TargetType="{x:Type igEditors:XamMaskedEditor}">                                                       
  <Style.Triggers>
      <DataTrigger Binding="{Binding Path=HasChoclates}" Value="True">
   <Setter Property="Mask" Value="####" />                                                               
      </DataTrigger>
      <DataTrigger Binding="{Binding Path=HasChoclates}" Value="False">
   <Setter Property="Mask" Value="###" />
      </DataTrigger>
  </Style.Triggers>
  <Setter Property="HorizontalContentAlignment" Value="Right" />
  <Setter Property="InvalidValueBehavior" Value="RetainValue" />
     </Style>
 </igDP:FieldSettings.EditorStyle>
    </igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:UnboundField>

Parents
No Data
Reply
  • 12875
    posted

    Hi,

     

    I don’t see any ValueConstraints in your definition.  I believe that is what is missing for you.

     

    I created an unbound column with the following xaml:

     

    <igDP:UnboundField  Name="Depot" Label="YColumn_REVERT" Visibility="Visible">

        <igDP:Field.Settings>

            <igDP:FieldSettings CellMinWidth="75" CellMaxWidth="75" CellWidth="75" EditAsType="{x:Type sys:String}">

            <igDP:FieldSettings.EditorStyle>

                       <Style TargetType="{x:Type igEditors:XamMaskedEditor}">

                           <Style.Triggers>

                                <DataTrigger Binding="{Binding Path=Depot}" Value="True">

                                    <Setter Property="Mask" Value="####" />

                                </DataTrigger>

                                <DataTrigger Binding="{Binding Path=Depot}" Value="False">

                                    <Setter Property="Mask" Value="###" />

                                </DataTrigger>

                            </Style.Triggers>

                            <Setter Property="HorizontalContentAlignment" Value="Right" />

                            <Setter Property="InvalidValueBehavior" Value="RetainValue" />

                                <Setter Property="ValueConstraint">

                                    <Setter.Value>

                                        <igEditors:ValueConstraint>

                                            <igEditors:ValueConstraint.Enumeration>

                                                <x:Array Type="{x:Type sys:Object}">

                                                    <sys:String>True</sys:String>

                                                    <sys:String>False</sys:String>

                                                </x:Array>

                                            </igEditors:ValueConstraint.Enumeration>

                                         </igEditors:ValueConstraint>

                                    </Setter.Value>

                                 </Setter>

                         </Style>

                   </igDP:FieldSettings.EditorStyle>

              </igDP:FieldSettings>

         </igDP:Field.Settings>

    </igDP:UnboundField>

     

    And loaded the row values in the initializeRecord event.

     

    When the cells were being edited, the value as modified was “retained” and you are unable to leave the cell.   A message box is displayed and the EditModeValidationError is triggered.  I believe that is the appropriate behavior.   

    Let me know what version of our NetAdvantage for WPF you are using and I can test further.  Or if you are expecting different behavior, please let me know.

     

     

     

Children
No Data