示例#1
0
        private bool EnsureDateTimeMaskHandler()
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null)
            {
                return(false);
            }
            RadDateTimePickerCalendar dateTimeBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            if (dateTimeBehavior == null)
            {
                return(false);
            }
            RadMaskedEditBoxElement maskTextBox = editorElement.TextBoxElement as RadMaskedEditBoxElement;

            if (maskTextBox == null)
            {
                return(false);
            }
            if (maskTextBox.TextBoxItem.SelectionLength == maskTextBox.Text.Length)
            {
                return(false);
            }
            this.dateTimeMaskHandler = maskTextBox.Provider as MaskDateTimeProvider;
            if (this.dateTimeMaskHandler == null)
            {
                return(false);
            }
            return(true);
        }
        private void MakeClipboardPaste()
        {
            if (this.TextBoxItem.ReadOnly)
            {
                return;
            }
            string clipboardText = RadMaskedEditBoxElement.GetClipboardText();

            if (this.provider is TextBoxProvider || this.provider is RegexMaskTextBoxProvider || this.provider is MaskDateTimeProvider)
            {
                this.TextBoxItem.Paste();
                if (!(this.provider is RegexMaskTextBoxProvider) && !(this.provider is MaskDateTimeProvider) || this.provider is FreeFormDateTimeProvider)
                {
                    return;
                }
                this.provider.Validate(this.TextBoxItem.Text);
            }
            else
            {
                foreach (char keyChar in clipboardText)
                {
                    this.provider.KeyPress((object)this, new KeyPressEventArgs(keyChar));
                }
            }
        }
        public static string Format(string mask, string text)
        {
            MaskedTextResultHint hint;
            int hintPosition;

            return(RadMaskedEditBoxElement.Format(mask, text, char.MinValue, (CultureInfo)null, out hint, out hintPosition));
        }
        public static string Format(string mask, string text, char promptChar, CultureInfo culture)
        {
            MaskedTextResultHint hint;
            int hintPosition;

            return(RadMaskedEditBoxElement.Format(mask, text, promptChar, culture, out hint, out hintPosition));
        }
 protected virtual IMaskCharacterProvider CreateNumericCharacterTextBoxProvider(
     string mask,
     CultureInfo culture,
     NumericCharacterTextBoxProvider.RadNumericMaskFormatType radNumericMaskFormatType,
     RadMaskedEditBoxElement owner)
 {
     return((IMaskCharacterProvider) new NumericCharacterTextBoxProvider(mask, culture, radNumericMaskFormatType, owner));
 }
        /// <summary>
        /// Format the specified text using the specified mask
        /// </summary>
        /// <param name="mask">The mask to use</param>
        /// <param name="text">The text to format</param>
        /// <returns>The formatted text string</returns>
        /// <overloads>There are four overloads for this method.</overloads>
        public static string Format(string mask, string text)
        {
            MaskedTextResultHint hint;
            int pos;

            return(RadMaskedEditBoxElement.Format(mask, text, '\x0', null,
                                                  out hint, out pos));
        }
        // Static methods

        /// <summary>
        /// Format the specified text using the specified mask and prompt
        /// character.
        /// </summary>
        /// <param name="mask">The mask to use.</param>
        /// <param name="text">The text to format.</param>
        /// <param name="promptChar">The prompt character to use for missing
        /// characters.  If a null character ('\x0') is specified, prompt
        /// characters are omitted.</param>
        /// <returns>The formatted text string.</returns>
        public static string Format(string mask, string text, char promptChar)
        {
            MaskedTextResultHint hint;
            int pos;

            return(RadMaskedEditBoxElement.Format(mask, text, promptChar, null,
                                                  out hint, out pos));
        }
示例#8
0
 public FreeFormDateTimeProvider(
     string mask,
     CultureInfo culture,
     RadMaskedEditBoxElement owner)
     : base(mask, culture, owner)
 {
     this.Parser            = new DateInput(this.Culture);
     this.Parser.DateFormat = this.Mask;
 }
 public IPMaskTextBoxProvider(
     CultureInfo culture,
     RadMaskedEditBoxElement owner,
     bool allowPromptAsInput,
     char promptChar,
     char passwordChar,
     bool restrictToAscii)
     : base("###.###.###.###", culture, owner, allowPromptAsInput, promptChar, passwordChar, restrictToAscii)
 {
 }
 public ArabicMaskDateTimeProvider(
     string mask,
     CultureInfo culture,
     RadMaskedEditBoxElement owner)
     : base(mask, culture, owner)
 {
     this.minTime = this.Culture.Calendar.MinSupportedDateTime;
     this.maxTime = this.Culture.Calendar.MaxSupportedDateTime;
     this.isFarsi = culture.ThreeLetterISOLanguageName == "fas" || culture.Calendar is HijriCalendar;
 }
示例#11
0
 public RegexMaskTextBoxProvider(string mask, CultureInfo culture, RadMaskedEditBoxElement owner)
 {
     this.mask        = mask;
     this.culture     = culture;
     this.owner       = owner;
     this.textBoxItem = owner.TextBoxItem;
     this.textBoxItem.HostedControl.Leave += new EventHandler(HostedControl_Leave);
     this.errorProvider            = new ErrorProvider();
     this.errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;
 }
 public NumericMaskTextBoxProvider(string mask, CultureInfo culture, RadMaskedEditBoxElement owner)
 {
     this.owner       = owner;
     this.numericType = GetFormat(mask, culture);
     this.mask        = mask;
     this.culture     = culture;
     this.provider    = new NumericCharacterTextBoxProvider(mask, culture, this.numericType, owner);
     this.promptChar  = this.provider.PromptChar;
     this.textBoxItem = owner.TextBoxItem;
 }
示例#13
0
        public override void BeginEdit()
        {
            this.Value = this.initialValue;

            base.BeginEdit();

            //This is need to always make selected the first part ot date mask when the editor is opened
            RadDateTimePickerElement  editor           = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement   = editor.TextBoxElement;
            RadDateTimePickerCalendar dateTimeBehavior = editor.CurrentBehavior as RadDateTimePickerCalendar;

            editor.TextBoxElement.TextBoxItem.HostedControl.Focus();
            editor.TextBoxElement.TextBoxItem.SelectionStart  = 0;
            editor.TextBoxElement.TextBoxItem.SelectionLength = 1;

            if (dateTimeBehavior != null)
            {
                dateTimeBehavior.DropDownMinSize = new Size(editor.Size.Width, 200);
                RadMaskedEditBoxElement maskTextBox = editor.TextBoxElement as RadMaskedEditBoxElement;
                MaskDateTimeProvider    maskHandler = (MaskDateTimeProvider)maskTextBox.Provider;
                maskHandler.SelectFirstEditableItem();
                this.selectedItemIndex = maskHandler.SelectedItemIndex;
                //int lastCaretPos = maskHandler.;
                //int lastSelectionPos = maskHandler.SelectionPosition;
                //while (maskHandler.SelectionPosition >= 0)
                //{
                //    lastSelectionPos = maskHandler.SelectionPosition;
                //    maskHandler.HandleLeftKey();
                //    if (lastSelectionPos == maskHandler.SelectionPosition)
                //        break;
                //}
                //this.selectedItemIndex = maskHandler.SelectedFormatInfoIndex;
                //maskTextBox.SelectionLength = maskHandler.SelectionLength;

                dateTimeBehavior.PopupControl.Opened += new EventHandler(PopupControl_Opened);
                dateTimeBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(PopupControl_Closed);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(ClearButton_Click);
                dateTimeBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(TodayButton_Click);

                if (editor.Value == editor.NullDate)
                {
                    maskTextBox.Text = String.Empty;
                }
            }

            editor.NotifyParentOnMouseInput = false;
            editor.BackColor      = Color.White;
            editor.ValueChanging += new ValueChangingEventHandler(RadDateTimeEditor_ValueChanging);
            editor.ValueChanged  += new EventHandler(RadDateTimeEditor_ValueChanged);

            if (textBoxElement != null)
            {
                textBoxElement.KeyDown += new KeyEventHandler(TextBoxElement_KeyDown);
            }
        }
示例#14
0
 protected override void CreateChildElements()
 {
     base.CreateChildElements();
     this.StretchHorizontally          = this.StretchVertically = false;
     this.maskedEditBoxElement         = new RadMaskedEditBoxElement();
     this.maskedEditBoxElement.Class   = "RadCommandBarTextBoxElement";
     this.maskedEditBoxElement.MinSize = this.defaultSize;
     this.MinSize = this.defaultSize;
     this.maskedEditBoxElement.Alignment = ContentAlignment.MiddleLeft;
     this.Children.Add((RadElement)this.maskedEditBoxElement);
 }
 /// <summary>
 /// Initializes a new instance of the NumericTextBoxProvider>
 /// class using the specified mask and culture.
 /// </summary>
 /// <param name="mask">
 /// A <see cref="T:System.String"/> that represents the input mask.
 /// </param>
 /// <param name="culture">
 /// A <see cref="T:System.Globalization.CultureInfo"/> that is used to set region-sensitive
 /// separator characters.
 /// </param>
 public NumericCharacterTextBoxProvider(string mask, System.Globalization.CultureInfo culture, RadNumericMaskFormatType numericType, RadMaskedEditBoxElement owner)
 {
     this.owner   = owner;
     this.mask    = mask;
     this.culture = culture;
     // this.value = this.ToString(true, true);
     this.numericType = numericType;
     this.promptChar  = '0';
     this.textBoxItem = owner.TextBoxItem;
     // this.originalValues = this.ToString(true, true);
 }
示例#16
0
        public override void BeginEdit()
        {
            this.Value = this.initialValue;
            base.BeginEdit();
            RadDateTimePickerElement  editorElement   = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement1 = (RadTextBoxElement)editorElement.TextBoxElement;
            RadDateTimePickerCalendar currentBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            editorElement.TextBoxElement.TextBoxItem.SelectAll();
            editorElement.TextBoxElement.TextBoxItem.HostedControl.Focus();
            if (currentBehavior != null)
            {
                currentBehavior.DropDownMinSize = new Size(editorElement.Size.Width, 200);
                RadMaskedEditBoxElement textBoxElement2 = editorElement.TextBoxElement;
                MaskDateTimeProvider    provider        = (MaskDateTimeProvider)textBoxElement2.Provider;
                if (editorElement.TextBoxElement.MaskType != MaskType.FreeFormDateTime)
                {
                    provider.SelectFirstEditableItem();
                }
                this.selectedItemIndex = provider.SelectedItemIndex;
                currentBehavior.PopupControl.Opened += new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(this.TodayButton_Click);
                DateTime?nullable = editorElement.Value;
                DateTime nullDate = editorElement.NullDate;
                if ((!nullable.HasValue ? 0 : (nullable.GetValueOrDefault() == nullDate ? 1 : 0)) != 0)
                {
                    textBoxElement2.Text = string.Empty;
                }
            }
            editorElement.NotifyParentOnMouseInput = false;
            if (!RadTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            editorElement.ValueChanging += new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  += new EventHandler(this.RadDateTimeEditor_ValueChanged);
            if (textBoxElement1 != null)
            {
                textBoxElement1.KeyDown += new KeyEventHandler(this.TextBoxElement_KeyDown);
                textBoxElement1.KeyUp   += new KeyEventHandler(this.textBoxElement_KeyUp);
            }
            if (editorElement.ElementTree != null)
            {
                RadControl control = editorElement.ElementTree.Control as RadControl;
                if (control != null && control.ThemeName == "TelerikMetroTouch" || ThemeResolutionService.ApplicationThemeName == "TelerikMetroTouch")
                {
                    editorElement.CalendarSize = new Size(300, 300);
                }
            }
            this.isValidated = false;
        }
 public StandartCharacterMaskEditBoxProvider(string mask, CultureInfo culture, RadMaskedEditBoxElement owner, bool allowPromptAsInput, char promptChar, char passwordChar, bool restrictToAscii)
 {
     this.owner = owner;
     this.allowPromptAsInput = allowPromptAsInput;
     this.promptChar         = promptChar;
     this.passwordChar       = passwordChar;
     this.restrictToAscii    = restrictToAscii;
     this.mask        = mask;
     this.culture     = culture;
     this.provider    = new MaskedTextProvider(mask, culture, allowPromptAsInput, promptChar, passwordChar, restrictToAscii);
     this.textBoxItem = owner.TextBoxItem;
 }
 public NumericCharacterTextBoxProvider(
     string mask,
     CultureInfo culture,
     NumericCharacterTextBoxProvider.RadNumericMaskFormatType numericType,
     RadMaskedEditBoxElement owner)
 {
     this.owner       = owner;
     this.mask        = mask;
     this.culture     = culture;
     this.numericType = numericType;
     this.promptChar  = '0';
     this.textBoxItem = owner.TextBoxItem;
 }
 public RegexMaskTextBoxProvider(
     string mask,
     CultureInfo culture,
     RadMaskedEditBoxElement owner)
 {
     this.mask        = mask;
     this.culture     = culture;
     this.owner       = owner;
     this.textBoxItem = owner.TextBoxItem;
     this.WireEvents();
     this.errorProvider            = new ErrorProvider();
     this.errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;
 }
示例#20
0
 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();
 }
 public NumericMaskTextBoxProvider(
     string mask,
     CultureInfo culture,
     RadMaskedEditBoxElement owner)
 {
     if (mask.ToLower() == "d")
     {
         mask += "0";
     }
     this.owner       = owner;
     this.numericType = NumericMaskTextBoxProvider.GetFormat(mask, culture);
     this.mask        = mask;
     this.culture     = culture;
     this.provider    = this.CreateNumericCharacterTextBoxProvider(mask, culture, this.numericType, owner);
     this.promptChar  = this.provider.PromptChar;
     this.textBoxItem = owner.TextBoxItem;
 }
示例#22
0
        private bool EnsureDateTimeMaskHandler()
        {
            RadDateTimePickerElement editorElement = this.EditorElement as RadDateTimePickerElement;

            if (editorElement == null || !(editorElement.CurrentBehavior is RadDateTimePickerCalendar))
            {
                return(false);
            }
            RadMaskedEditBoxElement textBoxElement = editorElement.TextBoxElement;

            if (textBoxElement == null || textBoxElement.TextBoxItem.SelectionLength == textBoxElement.Text.Length)
            {
                return(false);
            }
            this.dateTimeMaskHandler = textBoxElement.Provider as MaskDateTimeProvider;
            return(this.dateTimeMaskHandler != null);
        }
示例#23
0
 protected virtual void CreateTextEditorElement()
 {
     this.editBox          = (RadMaskedEditBoxElement) new RadTimeMaskedEditBoxElement();
     this.editBox.MaskType = MaskType.DateTime;
     this.editBox.Mask     = this.Format;
     this.layout.Children.Add((RadElement)this.editBox);
     if (this.Value != null)
     {
         DateTime dateTime = (DateTime)this.Value;
         this.editBox.MaxDate = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, this.MaxValue.Hour, this.MaxValue.Minute, this.MaxValue.Second);
         this.editBox.MinDate = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, this.MinValue.Hour, this.MinValue.Minute, this.MinValue.Second);
     }
     else
     {
         this.editBox.MaxDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, this.MaxValue.Hour, this.MaxValue.Minute, this.MaxValue.Second);
         this.editBox.MinDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, this.MinValue.Hour, this.MinValue.Minute, this.MinValue.Second);
     }
 }
示例#24
0
        public override void BeginEdit()
        {
            base.BeginEdit();
            RadDateTimePickerElement  editorElement   = (RadDateTimePickerElement)this.EditorElement;
            RadTextBoxElement         textBoxElement1 = (RadTextBoxElement)editorElement.TextBoxElement;
            RadDateTimePickerCalendar currentBehavior = editorElement.CurrentBehavior as RadDateTimePickerCalendar;

            editorElement.TextBoxElement.TextBoxItem.HostedControl.Focus();
            editorElement.TextBoxElement.TextBoxItem.SelectionStart  = 0;
            editorElement.TextBoxElement.TextBoxItem.SelectionLength = 1;
            if (currentBehavior != null)
            {
                currentBehavior.DropDownMinSize = new Size(editorElement.Size.Width, 200);
                RadMaskedEditBoxElement textBoxElement2 = editorElement.TextBoxElement;
                MaskDateTimeProvider    provider        = (MaskDateTimeProvider)textBoxElement2.Provider;
                provider.SelectFirstEditableItem();
                this.selectedItemIndex = provider.SelectedItemIndex;
                currentBehavior.PopupControl.Opened += new EventHandler(this.PopupControl_Opened);
                currentBehavior.PopupControl.Closed += new RadPopupClosedEventHandler(this.PopupControl_Closed);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.ClearButton.Click += new EventHandler(this.ClearButton_Click);
                currentBehavior.Calendar.CalendarElement.CalendarStatusElement.TodayButton.Click += new EventHandler(this.TodayButton_Click);
                DateTime?nullable = editorElement.Value;
                DateTime nullDate = editorElement.NullDate;
                if ((!nullable.HasValue ? 0 : (nullable.GetValueOrDefault() == nullDate ? 1 : 0)) != 0)
                {
                    textBoxElement2.Text = string.Empty;
                }
            }
            editorElement.NotifyParentOnMouseInput = false;
            if (!BaseTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            editorElement.ValueChanging += new ValueChangingEventHandler(this.RadDateTimeEditor_ValueChanging);
            editorElement.ValueChanged  += new EventHandler(this.RadDateTimeEditor_ValueChanged);
            if (textBoxElement1 == null)
            {
                return;
            }
            textBoxElement1.KeyDown += new KeyEventHandler(this.TextBoxElement_KeyDown);
            textBoxElement1.TextBoxItem.HostedControl.LostFocus += new EventHandler(this.HostedControl_LostFocus);
        }
 public void Dispose()
 {
     if (this.textBoxElement != null)
     {
         this.textBoxElement.ValueChanged          -= new EventHandler(this.maskBox_ValueChanged);
         this.textBoxElement.ValueChanging         -= new CancelEventHandler(this.maskBox_ValueChanging);
         this.textBoxElement.MaskProviderCreated   -= new EventHandler(this.textBoxElement_MaskProviderCreated);
         this.textBoxElement.TextBoxItem.LostFocus -= new EventHandler(this.MaskBox_LostFocus);
         this.textBoxElement.TextBoxItem.MouseDown -= new MouseEventHandler(this.maskBox_MouseDown);
         this.textBoxElement.KeyDown  -= new KeyEventHandler(this.textBoxElement_KeyDown);
         this.textBoxElement.KeyPress -= new KeyPressEventHandler(this.textBoxElement_KeyPress);
         this.textBoxElement.KeyUp    -= new KeyEventHandler(this.textBoxElement_KeyUp);
     }
     if (this.calendar != null)
     {
         this.calendar.SelectionChanged -= new EventHandler(this.calendar_SelectionChanged);
         this.calendar.Dispose();
         this.calendar = (RadCalendar)null;
     }
     if (this.timePicker != null)
     {
         this.timePicker.ValueChanged       -= new EventHandler(this.timePicker_ValueChanged);
         this.timePicker.CloseButtonClicked -= new EventHandler(this.timePicker_CloseButtonClicked);
     }
     if (this.popupControl != null)
     {
         this.popupControl.Opened  -= new EventHandler(this.popupControl_Opened);
         this.popupControl.Closing -= new RadPopupClosingEventHandler(this.popupControl_Closing);
         this.popupControl.Closed  -= new RadPopupClosedEventHandler(this.popupControl_Closed);
         this.popupControl.Dispose();
         this.popupControl = (RadDateTimePickerDropDown)null;
     }
     if (this.textBoxElement != null)
     {
         this.textBoxElement.Dispose();
         this.textBoxElement.DisposeChildren();
         this.textBoxElement = (RadMaskedEditBoxElement)null;
     }
     if (this.checkBox != null)
     {
         this.checkBox.Dispose();
         this.checkBox = (RadCheckBoxElement)null;
     }
     if (this.stackLayout != null)
     {
         this.stackLayout.Dispose();
         this.stackLayout = (StackLayoutElement)null;
     }
     if (this.border != null)
     {
         this.border.Dispose();
         this.border = (BorderPrimitive)null;
     }
     if (this.backGround != null)
     {
         this.backGround.Dispose();
         this.backGround = (FillPrimitive)null;
     }
     if (this.arrowButton == null)
     {
         return;
     }
     this.arrowButton.Dispose();
     this.arrowButton = (RadArrowButtonElement)null;
 }
示例#26
0
        public override void CreateChildren()
        {
            this.backGround       = new FillPrimitive();
            this.backGround.Class = "DateTimePickerBackGround";
            int num1 = (int)this.backGround.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);

            this.dateTimePickerElement.Children.Add((RadElement)this.backGround);
            this.border       = new BorderPrimitive();
            this.border.Class = "DateTimePickerBorder";
            this.dateTimePickerElement.Children.Add((RadElement)this.border);
            this.stackLayout = new StackLayoutElement();
            int num2 = (int)this.stackLayout.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)true);
            int num3 = (int)this.stackLayout.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);

            this.stackLayout.FitInAvailableSize = true;
            this.stackLayout.Class = "DateTimePickerSpinLayout";
            this.dateTimePickerElement.Children.Add((RadElement)this.stackLayout);
            this.checkBox = new RadCheckBoxElement();
            int num4 = (int)this.checkBox.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
            int num5 = (int)this.checkBox.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num6 = (int)this.checkBox.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleCenter);

            if (!this.dateTimePickerElement.ShowCheckBox)
            {
                this.checkBox.Visibility = ElementVisibility.Collapsed;
            }
            this.stackLayout.Children.Add((RadElement)this.checkBox);
            this.dateTimePickerElement.CheckBox = this.checkBox;
            this.textBoxElement = new RadMaskedEditBoxElement();
            this.textBoxElement.MaskProviderCreated += new EventHandler(this.textBoxElement_MaskProviderCreated);
            this.textBoxElement.Mask       = "";
            this.textBoxElement.MaskType   = MaskType.DateTime;
            this.textBoxElement.ShowBorder = false;
            this.textBoxElement.Class      = "textbox";
            this.textBoxElement.ThemeRole  = "DateTimePickerMaskTextBoxElement";
            int num7  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleLeft);
            int num8  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)true);
            int num9  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num10 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleLeft);
            int num11 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)false);
            int num12 = (int)this.textBoxElement.Fill.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);

            this.textBoxElement.TextBoxItem.HostedControl.RightToLeft = this.dateTimePickerElement.RightToLeft ? RightToLeft.Yes : RightToLeft.No;
            this.stackLayout.Children.Add((RadElement)this.textBoxElement);
            this.textBoxElement.Children[this.textBoxElement.Children.Count - 1].Visibility = ElementVisibility.Collapsed;
            this.textBoxElement.KeyDown                 += new KeyEventHandler(this.textBoxElement_KeyDown);
            this.textBoxElement.KeyPress                += new KeyPressEventHandler(this.textBoxElement_KeyPress);
            this.textBoxElement.KeyUp                   += new KeyEventHandler(this.textBoxElement_KeyUp);
            this.textBoxElement.ValueChanged            += new EventHandler(this.maskBox_ValueChanged);
            this.textBoxElement.ValueChanging           += new CancelEventHandler(this.maskBox_ValueChanging);
            this.textBoxElement.TextBoxItem.LostFocus   += new EventHandler(this.maskBox_LostFocus);
            this.textBoxElement.TextBoxItem.TextChanged += new EventHandler(this.maskBox_TextChanged);
            this.textBoxElement.MouseDown               += new MouseEventHandler(this.maskBox_MouseDown);
            this.buttonsLayout = new StackLayoutElement();
            int num13 = (int)this.buttonsLayout.SetDefaultValueOverride(StackLayoutElement.OrientationProperty, (object)Orientation.Vertical);
            int num14 = (int)this.buttonsLayout.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
            int num15 = (int)this.buttonsLayout.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);

            this.buttonsLayout.FitInAvailableSize = true;
            this.buttonsLayout.Class = "DateTimePickerSpinButtonsLayout";
            this.stackLayout.Children.Add((RadElement)this.buttonsLayout);
            this.upButton           = new RadRepeatArrowElement();
            this.upButton.ThemeRole = "UpButton";
            int num16 = (int)this.upButton.SetDefaultValueOverride(RadElement.PaddingProperty, (object)new Padding(3, 1, 3, 1));

            this.upButton.Click         += new EventHandler(this.upButton_Click);
            this.upButton.Direction      = Telerik.WinControls.ArrowDirection.Up;
            this.upButton.Arrow.AutoSize = true;
            this.upButton.CanFocus       = false;
            this.buttonsLayout.Children.Add((RadElement)this.upButton);
            this.downButton           = new RadRepeatArrowElement();
            this.downButton.ThemeRole = "DownButton";
            int num17 = (int)this.downButton.SetDefaultValueOverride(RadElement.PaddingProperty, (object)new Padding(3, 1, 3, 0));
            int num18 = (int)this.downButton.Border.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Visible);

            this.downButton.Click         += new EventHandler(this.downButton_Click);
            this.downButton.Arrow.AutoSize = true;
            this.downButton.Direction      = Telerik.WinControls.ArrowDirection.Down;
            this.downButton.CanFocus       = false;
            this.buttonsLayout.Children.Add((RadElement)this.downButton);
            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);
        }
示例#27
0
 public TextBoxProvider(RadMaskedEditBoxElement owner)
 {
     this.owner = owner;
 }
示例#28
0
        /// <summary>
        /// Creates dateTimePicker's children
        /// </summary>
        public override void CreateChildren()
        {
            this.textBoxElement           = new RadMaskedEditBoxElement();
            this.textBoxElement.KeyDown  += new KeyEventHandler(textBoxElement_KeyDown);
            this.textBoxElement.KeyPress += new KeyPressEventHandler(textBoxElement_KeyPress);
            this.textBoxElement.KeyUp    += new KeyEventHandler(textBoxElement_KeyUp);

            this.textBoxElement.Mask                     = "";
            this.textBoxElement.MaskType                 = MaskType.DateTime;
            this.textBoxElement.ValueChanged            += new EventHandler(maskBox_ValueChanged);
            this.textBoxElement.TextBoxItem.LostFocus   += new EventHandler(maskBox_LostFocus);
            this.textBoxElement.TextBoxItem.TextChanged += new EventHandler(maskBox_TextChanged);
            this.textBoxElement.MouseDown               += new MouseEventHandler(maskBox_MouseDown);
            this.textBoxElement.ShowBorder               = false;
            this.textBoxElement.Class                    = "textbox";
            this.textBoxElement.ThemeRole                = "DateTimePickerMaskTextBoxElement";

            this.dockLayout               = new DockLayoutPanel();
            this.border                   = new BorderPrimitive();
            this.backGround               = new FillPrimitive();
            this.checkBox                 = new RadCheckBoxElement();
            this.border.Class             = "DateTimePickerBorder";
            this.backGround.Class         = "DateTimePickerBackGround";
            this.backGround.GradientStyle = GradientStyles.Solid;

            this.checkBox.SetValue(DockLayoutPanel.DockProperty, Dock.Left);
            this.checkBox.Children[1].Alignment = ContentAlignment.MiddleLeft;

            this.checkBox.StretchHorizontally = false;
            this.textBoxElement.Alignment     = ContentAlignment.MiddleLeft;

            this.upButton                   = new RadRepeatArrowElement();
            this.upButton.ThemeRole         = "UpButton";
            this.upButton.Padding           = new Padding(3, 1, 3, 1);
            this.upButton.Border.Visibility = ElementVisibility.Visible;
            this.upButton.Click            += new EventHandler(upButton_Click);
            this.upButton.Direction         = ArrowDirection.Up;
            this.upButton.Arrow.AutoSize    = true;
            this.upButton.CanFocus          = false;

            this.downButton                   = new RadRepeatArrowElement();
            this.downButton.ThemeRole         = "DownButton";
            this.downButton.Padding           = new Padding(3, 1, 3, 0);
            this.downButton.Border.Visibility = ElementVisibility.Visible;
            this.downButton.Click            += new EventHandler(downButton_Click);
            this.downButton.Arrow.AutoSize    = true;
            this.downButton.Direction         = ArrowDirection.Down;
            this.downButton.CanFocus          = false;

            BoxLayout stackLayout = new BoxLayout();

            stackLayout.Orientation = Orientation.Vertical;
            BoxLayout.SetProportion(this.upButton, 1);
            BoxLayout.SetProportion(this.downButton, 1);
            stackLayout.Children.Add(this.upButton);
            stackLayout.Children.Add(this.downButton);

            if (this.dateTimePickerElement.RightToLeft)
            {
                this.checkBox.SetValue(DockLayoutPanel.DockProperty, Dock.Right);
                this.checkBox.Children[1].Alignment = ContentAlignment.MiddleLeft;
                stackLayout.SetValue(DockLayoutPanel.DockProperty, Dock.Left);
                stackLayout.RightToLeft = false;
                this.textBoxElement.TextBoxItem.HostedControl.RightToLeft = RightToLeft.Yes;
            }
            else
            {
                this.checkBox.SetValue(DockLayoutPanel.DockProperty, Dock.Left);
                this.checkBox.Children[1].Alignment = ContentAlignment.MiddleLeft;
                stackLayout.SetValue(DockLayoutPanel.DockProperty, Dock.Right);
                this.textBoxElement.TextBoxItem.HostedControl.RightToLeft = RightToLeft.No;
            }

            this.dockLayout.Children.Add(this.checkBox);
            this.dockLayout.Children.Add(stackLayout);
            this.dockLayout.Children.Add(this.textBoxElement);

            this.dateTimePickerElement.Children.Add(this.backGround);
            this.dateTimePickerElement.Children.Add(this.dockLayout);
            this.dateTimePickerElement.Children.Add(this.border);

            this.dateTimePickerElement.checkBox = this.checkBox;

            if (!this.dateTimePickerElement.ShowCheckBox)
            {
                this.checkBox.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
            }

            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);

            // The BorderPrimitive of the RadTextBoxElement should be collapsed. This makes the size of the editors equal
            this.textBoxElement.Children[this.textBoxElement.Children.Count - 1].Visibility = ElementVisibility.Collapsed;
            this.border.Visibility = ElementVisibility.Visible;

            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);
        }
 public EMailMaskTextBoxProvider(CultureInfo culture, RadMaskedEditBoxElement owner)
     : base(EMailMaskTextBoxProvider.mask, culture, owner)
 {
     this.ErrorMessage = "E-Mail is not valid";
 }
        public override void CreateChildren()
        {
            this.backGround       = new FillPrimitive();
            this.backGround.Class = "DateTimePickerBackGround";
            int num1 = (int)this.backGround.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);

            this.dateTimePickerElement.Children.Add((RadElement)this.backGround);
            this.border            = new BorderPrimitive();
            this.border.Class      = "DateTimePickerBorder";
            this.border.Visibility = ElementVisibility.Visible;
            this.dateTimePickerElement.Children.Add((RadElement)this.border);
            this.stackLayout = new StackLayoutElement();
            int num2 = (int)this.stackLayout.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)true);
            int num3 = (int)this.stackLayout.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);

            this.stackLayout.Class = "DateTimePickerCalendarLayout";
            this.stackLayout.FitInAvailableSize = true;
            this.stackLayout.CanFocus           = false;
            this.dateTimePickerElement.Children.Add((RadElement)this.stackLayout);
            this.checkBox = new RadCheckBoxElement();
            int num4 = (int)this.checkBox.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
            int num5 = (int)this.checkBox.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num6 = (int)this.checkBox.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleCenter);

            this.stackLayout.Children.Add((RadElement)this.checkBox);
            this.dateTimePickerElement.CheckBox = this.checkBox;
            if (!this.dateTimePickerElement.ShowCheckBox)
            {
                this.checkBox.Visibility = ElementVisibility.Collapsed;
            }
            this.textBoxElement = new RadMaskedEditBoxElement();
            this.textBoxElement.MaskProviderCreated += new EventHandler(this.textBoxElement_MaskProviderCreated);
            this.textBoxElement.Mask       = "";
            this.textBoxElement.ShowBorder = false;
            this.textBoxElement.Class      = "textbox";
            this.textBoxElement.ThemeRole  = "DateTimePickerMaskTextBoxElement";
            int num7  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleLeft);
            int num8  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)true);
            int num9  = (int)this.textBoxElement.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num10 = (int)this.textBoxElement.Border.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Hidden);
            int num11 = (int)this.textBoxElement.Border.SetDefaultValueOverride(VisualElement.ForeColorProperty, (object)Color.Transparent);
            int num12 = (int)this.textBoxElement.Fill.SetDefaultValueOverride(FillPrimitive.GradientStyleProperty, (object)GradientStyles.Solid);
            int num13 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)false);
            int num14 = (int)this.textBoxElement.TextBoxItem.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleLeft);

            this.stackLayout.Children.Add((RadElement)this.textBoxElement);
            int num15 = (int)this.textBoxElement.Children[this.TextBoxElement.Children.Count - 1].SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Collapsed);

            this.textBoxElement.MaskType               = MaskType.DateTime;
            this.textBoxElement.ValueChanged          += new EventHandler(this.maskBox_ValueChanged);
            this.textBoxElement.ValueChanging         += new CancelEventHandler(this.maskBox_ValueChanging);
            this.textBoxElement.TextBoxItem.LostFocus += new EventHandler(this.MaskBox_LostFocus);
            this.textBoxElement.TextBoxItem.MouseDown += new MouseEventHandler(this.maskBox_MouseDown);
            this.textBoxElement.KeyDown  += new KeyEventHandler(this.textBoxElement_KeyDown);
            this.textBoxElement.KeyPress += new KeyPressEventHandler(this.textBoxElement_KeyPress);
            this.textBoxElement.KeyUp    += new KeyEventHandler(this.textBoxElement_KeyUp);
            this.arrowButton              = (RadArrowButtonElement) new RadDateTimePickerArrowButtonElement();
            this.arrowButton.Class        = "ArrowButton";
            int num16 = (int)this.arrowButton.SetDefaultValueOverride(RadElement.StretchHorizontallyProperty, (object)false);
            int num17 = (int)this.arrowButton.SetDefaultValueOverride(RadElement.StretchVerticallyProperty, (object)true);
            int num18 = (int)this.arrowButton.Arrow.SetDefaultValueOverride(RadElement.AutoSizeProperty, (object)true);
            int num19 = (int)this.arrowButton.Arrow.SetDefaultValueOverride(RadElement.AlignmentProperty, (object)ContentAlignment.MiddleCenter);
            int num20 = (int)this.arrowButton.SetDefaultValueOverride(RadElement.MinSizeProperty, (object)new Size(17, 6));

            this.stackLayout.Children.Add((RadElement)this.arrowButton);
            this.arrowButton.MouseDown -= new MouseEventHandler(this.arrowButton_MouseDown);
            this.arrowButton.MouseDown += new MouseEventHandler(this.arrowButton_MouseDown);
            if (this.dateTimePickerElement.RightToLeft)
            {
                this.calendar.RightToLeft = RightToLeft.Yes;
            }
            else
            {
                this.calendar.RightToLeft = RightToLeft.No;
            }
            this.SetDateByValue(this.dateTimePickerElement.Value, this.dateTimePickerElement.Format);
            this.calendar.RangeMinDate = this.DateTimePickerElement.MinDate;
            this.calendar.RangeMaxDate = this.DateTimePickerElement.MaxDate;
        }