I've got a column in my data grid, which is data bound correctly and working. Now, I'd like to affect its format. So I've implemented a converter and connected it to the field.
<local:DateTimeFormat x:Key="IncludeTime" />
...
<igDP:Field Name="CreatedOn"
Label="Label"
Converter="{StaticResource IncludeTime}">
</igDP:Field>
Apparently, something is wrong, because I see no change in the window. However, when I put a break point in the converter, it gets hit and when I execute the statement in the Immediate Window, it gets the string as supposed to.
public class DateTimeFormat : IValueConverter
{
public object Convert(object v, Type t, object p, CultureInfo c)
{
if (v is DateTime)
return System.Convert.ToDateTime(v).ToString("yyyy-MM-dd HH:mm:ss");
return Binding.DoNothing;
}
...
}
My guess is that I'm not connecting the output of the converter to right piece of the mark-up but it beats me how to resolve it.
Please note that I'm looking for a general approach applying converters to fields in my data grid, so styling isn't going to do it (although there might be an approach covering dates, times and currencies).