Hi,
I'm required to show the following format througt the application "yyyy-MMM-dd". I define the thread as follow
var cultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture(""); var dateTimeFormatInfo = new DateTimeFormatInfo(); dateTimeFormatInfo.ShortDatePattern = "yyyy-MMM-dd"; dateTimeFormatInfo.DateSeparator = "-"; cultureInfo.DateTimeFormat = dateTimeFormatInfo; System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
Everything works fine however the when I go to edit mode the format goes to "yyyy-MM-dd" and I have no idea where that come from.
Regards,
Dominik
Hi Andrew,
Thanks for you're answer.
Sorry I'm confuse you wrote "based upon using a specified mask and it does the parsing/validation based on that mask", so it suppose I can you any mask that I want since it's specified. So how can I specify "yyyy-MMM-dd"
I really need this to get done, and the behavior should be the same (validation, spin, ...). We naturally expected that a date time control allow the format to be changed.
I don't really have a way around this. The xamDateTimeEditor is based upon using a specified mask and it does the parsing/validation based on that mask. You might be able to re-template the xamDateTimeEditor to have a TextBox that is bound to the Value property and use your own ValueConverter to handle converting between the DateTime (or null) from the Value and the string needed for the textbox but that will circumvent the masking and I don't think you'll be able to do anything in terms of validating the value.
Ok, but how can I change that behavior, any solution is acceptable. Is it possible to inherit from XamDateTimeEditor and override something.
The masked editor (xamDateTimeEditor is a derived xamMaskedEditor) does not currently support Month/Day name sections - only the numeric value - so that is why the mask is using "MM" when you go into edit mode.