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
225
How to display Int data in Dataset as String in grid
posted

Hi,

I have a column in a datacontext which is an integer( 0,1)

While displaying these in the Xamdatagrid, i want to display: 0 as "NO" & 1 as "Yes".

Could somebody please guide me thru this?? Thanks!!

Parents
No Data
Reply
  • 69686
    Suggested Answer
    posted

    Hello,

    For this, you can use IValueConverter class and apply it to the Field's Converter property. the converter would look something like this:

    class ValueToEnumConverter :IValueConverter

        {

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

            {

                if (value == null)

                    return Binding.DoNothing;

                if (value.ToString() == "1")

                    return "Yes";

                else

                    return value;

            }

    ...

        }

    Hope this helps.

Children
No Data