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
205
DateTime "Kind" changes to "Unspecified" after editing
posted

We have several grids with DateTime values, and all values have their DateTime.Kind set to either UTC or Local depending on what data we're displaying/editing.  We've found that if the user edits one of these values using the XamDateTimeEditor in a XamDataGrid, the DateTime.Kind of the bound data gets changed to Unspecified.  Is this behavior expected and is there a way for the modified value to maintain the original DateTime.Kind?  This is causing problems in determining whether or not the modified data needs to be converted back to UTC as it gets passed across layers of the application.

Thanks,

Steve

  • 300
    Offline posted

    Hello Steve,

    XamDateTimeEditor uses a DateTime structure and reads from the set properties in order to display data. As the default constructor initializes the Kind property to Unspecified(source), I'd say it is expected behavior. 

    In order to set the Kind property, you'd need to either specify it when inserting new time or add converter to the field, which I find to be much more convenient. 

    Should you have further questions, please let me know.

    Sincerely,
    Tihomir Tonev
    Associate Software Developer