Pardon me while I include you all in my inner monologue.I implemented a solution that does exactly what my last update asked about - I just had to remember that one can set his own Converter (IValueConverter) on a Binding object.Here is where we set up binding on the popup window. My change is in bold.foreach (string field in fields)
{
if (aliases.Keys.Contains(field))
{
TextBlock valueBlock = new TextBlock() { TextWrapping = TextWrapping.NoWrap };
Binding valueBinding = new Binding() { Path = new PropertyPath(string.Format("[{0}]", field)), StringFormat = aliases[field] + ": {0}" };
valueBinding.Converter = new DateTimeConverter();
valueBlock.SetBinding(TextBlock.TextProperty, valueBinding);
stackBox.Children.Add(valueBlock);
}
}
And here is the implementation of the DateTimeConverter:public class DateTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is DateTime)
return (((DateTime)value).Kind != DateTimeKind.Utc) ? ((DateTime)value).ToUniversalTime() : value;
else
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value;
}
}
So, to recap, when I edit a graphic and set its date to a DateTime.Now, the resulting DateTime is of Kind=Local. I subtract 6 hours from it, so when it is saved, in the process being converted to UTC by the API, what ends up in Oracle is the correct local time. But having subtracted 6 hours, my tip window shows the date as 6 hours in the past - now corrected by this Converter. Any DateTime coming out of the DataBase is marked with Kind=Utc by the API, so it is ignored by this Converter.Whew!So please continue with your regular scheduled program, thanks for listening!