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
1025
How to display bound checkbox using converter.
posted

I have xml data that comes in the form of "Y", "N", and "". I have a field defined with the converter but my grid fails to render any of the columns when I try to do this. Any Ideas?

<igDP:Field Name="read_only" Label="Read Only" DataType="{x:Type sys:Boolean}" Converter="{StaticResource MyBooleanConverter}"/>

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

{

if (value == null || value is System.DBNull)

{

return null;

}

else if (((string)(value)) == "Y")

{

return true;

}

else if (((string)(value)) == "N")

{

return false;

}

else

{

return null;

}

}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

{

if (value == null)

{

return null;

}

else if (((bool)(value)) == true)

{

return "Y";

}

else

{

return "N";

}

}

 

 

 

  • 9694
    posted

    Hello,

    To get this to work, I had to modify the XAML accordingly:

    <igDP:Field Name="read_only" Label="Read Only"
           
    DataType="{x:Type sys:String}"
           
    Converter="{StaticResource MyBooleanConverter}">
       
    <igDP:Field.Settings>
          
    <igDP:FieldSettings EditAsType="{x:Type sys:Boolean}" />
       
    </igDP:Field.Settings>
    </
    igDP:Field>