> I have to store the data in universal time, so changing to store local is not an option.
> Which template(s) do I need to change? In addition, I have a ListView that shows all my
> meetings. So can I convert my times before displaying, Yes, should i have to, no. There
> needs to be a way to change this. There should be an option to define a converter on the
> NestedProperty.
I think, changing times in templates is a wrong decision. There are a lot of internal
calculations which are made with using appointment times. All these operations should be
done with the same times.
Supporting different DateTimeKind values is in our todo list. We have no time frame for
this feature yet. Is that urgent for you?
Do you use recurring events? If no, perhaps you can try to workaround the issue by
changing times when appointments are readed and stored from/to database. For example, if
you have typed dataset for Appointments table, you may change getters and setters for
DateTime fields.
Here is a part of autogenerated code for AppointmentsRow class from my test project:
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator",
"2.0.0.0")]
public partial class AppointmentsRow : global::System.Data.DataRow {
.... skipped
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.DateTime End {
get {
try {
return
((global::System.DateTime)(this[this.tableAppointments.EndColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for
column \'End\' in table \'Appointments\' is DBNull.", e);
}
}
set {
this[this.tableAppointments.EndColumn] = value;
}
}
You can change the code in the next way:
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.DateTime End {
get {
try {
// convert to local time at reading
global::System.DateTime dataBaseValue =
((global::System.DateTime)(this[this.tableAppointments.EndColumn]));
global::System.DateTime.SpecifyKind(localValue, DateTimeKind.Utc);
return dataBaseValue .ToLocalTime();
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for
column \'End\' in table \'Appointments\' is DBNull.", e);
}
}
set {
// convert to univeral time before storing
global::System.DateTime localValue = value;
global::System.DateTime.SpecifyKind(localValue,
DateTimeKind.Local);
this[this.tableAppointments.EndColumn] = localValue
..ToUniversalTime() ;
}
}