Esempio n. 1
0
        static void OnFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CDate c = (CDate)d;

            // 确定格式
            string format    = ((string)e.NewValue).ToLower();
            int    dateIndex = format.IndexOf("yy");
            int    timeIndex = format.IndexOf("hh");

            if (dateIndex > -1)
            {
                if (timeIndex > -1)
                {
                    c._format     = DateFormatType.DateTime;
                    c._dateInTail = timeIndex < dateIndex;
                }
                else
                {
                    c._format = DateFormatType.Date;
                }
            }
            else if (timeIndex > -1)
            {
                c._format = DateFormatType.Time;
            }
            else
            {
                throw new Exception("日期时间格式串错误!");
            }
        }
Esempio n. 2
0
 public DateValUIConverter(CDate p_owner)
 {
     _owner = p_owner;
 }