tags:

views:

24

answers:

1

Hello.. Is there a solution to bind from a dataset a collumn and convert the database DateTime value to Date value and display it? Also i would like a boolean column from the database to be displayed as True/ False and not checkbox...Any ideas?

+1  A: 

You can use converters to control the way the bound data is displayed

For instance, to display true/false:

[ValueConversion(typeof(bool), typeof(string))]
public class TrueFalseConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        bool boolean = (bool)boolean;
        return boolean.ToString();
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
// Convert the other way around if needed else throw NotImplementedException...
    }
}
vc 74
tried that works great:)But for date stringformat did the trick.. however for other collumn i used that
Parhs