internal string GetFormatString(DateTimeFormat dateTimeFormat) { switch (dateTimeFormat) { case DateTimeFormat.ShortDate: return(CultureInfo.DateTimeFormat.ShortDatePattern); case DateTimeFormat.LongDate: return(CultureInfo.DateTimeFormat.LongDatePattern); case DateTimeFormat.ShortTime: return(CultureInfo.DateTimeFormat.ShortTimePattern); case DateTimeFormat.LongTime: return(CultureInfo.DateTimeFormat.LongTimePattern); case DateTimeFormat.FullDateTime: return(CultureInfo.DateTimeFormat.FullDateTimePattern); case DateTimeFormat.MonthDay: return(CultureInfo.DateTimeFormat.MonthDayPattern); case DateTimeFormat.RFC1123: return(CultureInfo.DateTimeFormat.RFC1123Pattern); case DateTimeFormat.SortableDateTime: return(CultureInfo.DateTimeFormat.SortableDateTimePattern); case DateTimeFormat.UniversalSortableDateTime: return(CultureInfo.DateTimeFormat.UniversalSortableDateTimePattern); case DateTimeFormat.YearMonth: return(CultureInfo.DateTimeFormat.YearMonthPattern); case DateTimeFormat.Custom: { switch (this.FormatString) { case "d": return(CultureInfo.DateTimeFormat.ShortDatePattern); case "t": return(CultureInfo.DateTimeFormat.ShortTimePattern); case "T": return(CultureInfo.DateTimeFormat.LongTimePattern); case "D": return(CultureInfo.DateTimeFormat.LongDatePattern); case "f": return(CultureInfo.DateTimeFormat.LongDatePattern + " " + CultureInfo.DateTimeFormat.ShortTimePattern); case "F": return(CultureInfo.DateTimeFormat.FullDateTimePattern); case "g": return(CultureInfo.DateTimeFormat.ShortDatePattern + " " + CultureInfo.DateTimeFormat.ShortTimePattern); case "G": return(CultureInfo.DateTimeFormat.ShortDatePattern + " " + CultureInfo.DateTimeFormat.LongTimePattern); case "m": return(CultureInfo.DateTimeFormat.MonthDayPattern); case "y": return(CultureInfo.DateTimeFormat.YearMonthPattern); case "r": return(CultureInfo.DateTimeFormat.RFC1123Pattern); case "s": return(CultureInfo.DateTimeFormat.SortableDateTimePattern); case "u": return(CultureInfo.DateTimeFormat.UniversalSortableDateTimePattern); default: return(FormatString); } } default: throw new ArgumentException("Not a supported format"); } }
protected virtual void OnFormatChanged(DateTimeFormat oldValue, DateTimeFormat newValue) { FormatUpdated(); }