示例#1
0
        protected override void OnTextChanged(string previousValue, string currentValue)
        {
            //TODO: clean this up and make sure it doesn't fire recursively
            if (String.IsNullOrEmpty(currentValue))
            {
                Value = null;
                return;
            }

            DateTime current = Value.HasValue ? Value.Value : DateTime.Now;
            DateTime result;
            var      success = _dateTimeParser.TryParse(currentValue, out result, current);

            SyncTextAndValueProperties(InputBase.TextProperty, result.ToString());
        }
        protected override void OnTextChanged(string previousValue, string currentValue)
        {
            if (!_processTextChanged)
            {
                return;
            }

            //TODO: clean this up and make sure it doesn't fire recursively
            if (String.IsNullOrEmpty(currentValue))
            {
                Value = null;
                return;
            }

            DateTime current = Value.HasValue ? Value.Value : DateTime.Parse(DateTime.Now.ToString(), CultureInfo.DateTimeFormat);
            DateTime result;
            var      success = DateTimeParser.TryParse(currentValue, GetFormatString(Format), current, CultureInfo, out result);

            SyncTextAndValueProperties(InputBase.TextProperty, result.ToString(CultureInfo));
        }