예제 #1
0
        protected virtual string GetValueForTextBox()
        {
            var format          = SelectedTimeFormat == TimePickerFormat.Long ? string.Intern(SpecificCultureInfo.DateTimeFormat.LongTimePattern) : string.Intern(SpecificCultureInfo.DateTimeFormat.ShortTimePattern);
            var valueForTextBox = SelectedDateTime?.ToString(string.Intern(format), SpecificCultureInfo);

            return(valueForTextBox);
        }
        ///<summary>
        ///Retrieves the formatted value of the cell.
        ///</summary>
        ///
        ///<returns>
        ///An <see cref="T:System.Object"></see> that represents the formatted version of the cell contents.
        ///</returns>
        ///
        ///<param name="context">A bitwise combination of <see cref="T:System.Windows.Forms.DataGridViewDataErrorContexts"></see> values that specifies the context in which the data is needed.</param>
        public object GetEditingControlFormattedValue(DataGridViewDataErrorContexts context)
        {
            if (mv.MonthViewControl.IsNull)
            {
                return(string.Empty);
            }

            return(SelectedDateTime?.ToString("G"));
        }
        private void Render()
        {
            SelectedYearMonth   = SelectedDateTime.ToString("yyyy年MM月");
            SelectedYear        = SelectedDateTime.ToString("yyyy年");
            SelectedHour        = SelectedDateTime.ToString("HH");
            SelectedMinutes     = SelectedDateTime.ToString("mm");
            SelectedDateTimeStr = SelectedDateTime.ToString($"yyyy年MM月dd日 星期{ToCNWeekString()} HH:mm");
            YearNum             = SelectedDateTime.Year;
            MonthNum            = SelectedDateTime.Month;

            //SelectedTime = SelectedDateTime.ToString("HH:mm");
        }
        private void MarkSelectedBtn()
        {
            //标记选择的日期
            string key = SelectedDateTime.ToString("yyyyMd");

            if (daysButtons.ContainsKey(key))
            {
                daysButtons[key].IsEnabled = false;
                if (selectedButton != null)
                {
                    selectedButton.IsEnabled = true;
                }
                selectedButton = daysButtons[key];
            }
        }
예제 #5
0
        private void UpdateText()
        {
            switch (DateTimePickerMode)
            {
            case DateTimePickerMode.DateTime:
                Text = SelectedDateTime.ToString("yyyy-MM-dd HH:mm:ss");
                break;

            case DateTimePickerMode.Date:
                Text = SelectedDateTime.ToString("yyyy-MM-dd");
                break;

            case DateTimePickerMode.Time:
                Text = SelectedDateTime.ToString("HH:mm:ss");
                break;
            }
        }
 /// <summary>
 /// Updates text representation of the selected value
 /// </summary>
 public override void UpdateTextValue()
 {
     if (mv.MonthViewControl.IsNull)
     {
         Text = FALocalizeManager.GetLocalizerByCulture(Thread.CurrentThread.CurrentUICulture).GetLocalizedString(StringID.Validation_NullText);
     }
     else
     {
         if (mv.MonthViewControl.DefaultCulture.Equals(mv.MonthViewControl.PersianCulture))
         {
             Text = ((PersianDate)SelectedDateTime).ToString(GetFormatByFormatInfo(FormatInfo));
         }
         else
         {
             Text = SelectedDateTime.ToString(GetFormatByFormatInfo(FormatInfo), mv.MonthViewControl.DefaultCulture);
         }
     }
 }
 public HseDatePicker()
 {
     this.InitializeComponent();
     //DataContext = this;
     InputTextBox.AddHandler(KeyDownEvent, new KeyEventHandler((s, e) =>
     {
         if (e.Key == Windows.System.VirtualKey.Enter || e.Key == Windows.System.VirtualKey.Space)
         {
             //DatePickerPart.SelectedDateRange = new CalendarDateRange(SelectedDateTime, SelectedDateTime);
             //DatePickerPart.DisplayDate = SelectedDateTime;
             UpdateSelectedDateTimeString(SelectedDateTime.ToString("dd/MM/yyyy"));
         }
         else if (e.Key == Windows.System.VirtualKey.Delete)
         {
             SelectedDateTime = new DateTime();
             //DatePickerPart.SelectedDateRange = null;
             //DatePickerPart.MoveToDate(DateTime.Now);
             UpdateSelectedDateTimeString("");
         }
     }), true);
 }
예제 #8
0
        protected virtual string GetValueForTextBox()
        {
            var valueForTextBox = SelectedDateTime?.ToString();

            return(valueForTextBox);
        }
예제 #9
0
 /// <summary>
 /// 텍스트 반환 오버라이딩 함수
 /// </summary>
 ///
 /// <returns>[string] yyyy-MM-dd HH:mm 형식의 시간 문자열</returns>
 protected override string GetValueForTextBox()
 {
     return(SelectedDateTime?.ToString("yyyy-MM-dd HH:mm"));
 }