public override bool Validate(string stringValue) { CancelEventArgs e = new CancelEventArgs(); this.Owner.CallValueChanging(e); if (e.Cancel) { return(false); } this.MaskFromFormat = MaskDateTimeProvider.GetSpecificFormat(this.Mask, this.Culture.DateTimeFormat); DateTime?date = this.Parser.ParseDate(stringValue, new DateTime?()); if (date.HasValue) { this.TextBoxItem.Text = date.Value.ToString(this.MaskFromFormat, (IFormatProvider)this.Culture); this.Value = (object)date.Value; this.List = MaskDateTimeProvider.FillCollection(this.MaskFromFormat, this.Culture.DateTimeFormat); this.FillCollectionWithValues(this.List, this.value, this.Mask); this.SelectCurrentItemWithSelectedItem(); } else { this.Owner.Value = (object)null; } return(false); }
public MaskDateTimeProvider(string mask, CultureInfo culture, RadMaskedEditBoxElement owner) { this.owner = owner; this.textBoxItem = owner.TextBoxItem; this.mask = mask; this.culture = culture; this.textBoxItem = owner.TextBoxItem; this.dateTimeFormatInfo = culture.DateTimeFormat; this.maskFromFormat = MaskDateTimeProvider.GetSpecificFormat(mask, culture.DateTimeFormat); this.list = MaskDateTimeProvider.FillCollection(this.maskFromFormat, culture.DateTimeFormat); this.FillCollectionWithValues(list, this.value, this.mask); this.selectedItemIndex = 0; this.SelectFirstEditableItem(); }