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
235
Using a checkbox for String values "1" and "0" instead of true and false
posted

in Winforms, I can use a CheckEditorDataFilter (see below) to transform the boolean values that a checkeditor usually works with to string values.

if the value in the field is "1", the checkbox is checked, and if it is "0" (or String.Empty) the checkbox is not checked.

And when I check the checkbox, it will flip a "1" to a "0" and vice versa.

is this possible with the igx-grid?

Public Class CheckEditorDataFilter
    Implements Infragistics.Win.IEditorDataFilter
    Public Function Convert(ByVal args As Infragistics.Win.EditorDataFilterConvertArgs) As Object Implements Infragistics.Win.IEditorDataFilter.Convert

        If args.Value & "" = "Received" Then Return "0"

        Select Case args.Direction
            Case Infragistics.Win.ConversionDirection.EditorToOwner
                args.Handled = True
                Select Case CType(args.Value, CheckState)
                    Case CheckState.Checked
                        Return "1"
                    Case CheckState.Unchecked
                        Return "0"
                    Case CheckState.Indeterminate
                        Return "0"
                        'Return String.Empty
                    Case Else
                        Return "0"
                        'Return CheckState.Indeterminate
                End Select
            Case Infragistics.Win.ConversionDirection.OwnerToEditor
                args.Handled = True
                If args.Value & "" = "1" Then
                    'Return 1
                    Return CheckState.Checked
                ElseIf args.Value & "" = "0" Then
                    'Return 0
                    Return CheckState.Unchecked
                Else
                    Return CheckState.Unchecked
                    'Return CheckState.Indeterminate
                End If
            Case Else
                Return "0"
                'Return CheckState.Indeterminate
        End Select
    End Function

End Class

Parents Reply Children
No Data