Пример #1
0
        public override void BeginEdit()
        {
            base.BeginEdit();
            RadTextBoxEditorElement editorElement = (RadTextBoxEditorElement)this.EditorElement;
            RadTextBoxItem          textBoxItem   = editorElement.TextBoxItem;

            if (!RadTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            RadControl radControl = this.EditorElement.ElementTree == null || this.EditorElement.ElementTree.Control == null ? (RadControl)null : this.EditorElement.ElementTree.Control as RadControl;

            if (radControl != null && TelerikHelper.IsMaterialTheme(radControl.ThemeName))
            {
                textBoxItem.StretchVertically = true;
                if (this.EditorElement.Parent != null)
                {
                    this.EditorElement.Parent.UpdateLayout();
                }
            }
            else
            {
                textBoxItem.StretchVertically = textBoxItem.Multiline;
            }
            textBoxItem.SelectAll();
            textBoxItem.TextBoxControl.Focus();
            textBoxItem.TextChanging += new TextChangingEventHandler(this.TextBoxItem_TextChanging);
            textBoxItem.TextChanged  += new EventHandler(this.TextBoxItem_TextChanged);
            textBoxItem.KeyDown      += new KeyEventHandler(this.TextBoxItem_KeyDown);
            textBoxItem.KeyUp        += new KeyEventHandler(this.TextBoxItem_KeyUp);
            textBoxItem.MouseWheel   += new MouseEventHandler(this.TextBoxItem_MouseWheel);
        }
Пример #2
0
        public override void InitializeEditor(IInputEditor editor)
        {
            RadTextBoxEditor radTextBoxEditor = editor as RadTextBoxEditor;

            if (radTextBoxEditor != null)
            {
                radTextBoxEditor.MaxLength       = this.MaxLength;
                radTextBoxEditor.Multiline       = this.Multiline;
                radTextBoxEditor.AcceptsTab      = this.AcceptsTab;
                radTextBoxEditor.AcceptsReturn   = this.AcceptsReturn;
                radTextBoxEditor.CharacterCasing = this.ColumnCharacterCasing;
                radTextBoxEditor.NullValue       = this.NullValue != null?RadDataConverter.Instance.Format(this.NullValue, typeof(string), (IDataConversionInfoProvider)this) as string : (string)null;
            }
            else
            {
                RadTextBoxControlEditor boxControlEditor = editor as RadTextBoxControlEditor;
                if (boxControlEditor == null)
                {
                    return;
                }
                boxControlEditor.MaxLength       = this.MaxLength;
                boxControlEditor.Multiline       = this.Multiline;
                boxControlEditor.AcceptsTab      = this.AcceptsTab;
                boxControlEditor.AcceptsReturn   = this.AcceptsReturn;
                boxControlEditor.CharacterCasing = this.ColumnCharacterCasing;
                boxControlEditor.NullText        = this.NullValue != null?RadDataConverter.Instance.Format(this.NullValue, typeof(string), (IDataConversionInfoProvider)this) as string : (string)null;
            }
        }
Пример #3
0
        public override void BeginEdit()
        {
            base.BeginEdit();
            RadMaskedEditBoxEditorElement editorElement = this.EditorElement as RadMaskedEditBoxEditorElement;
            string str = this.MaskTextBox.Value != null?this.MaskTextBox.Value.ToString() : this.MaskTextBox.Text;

            if (editorElement.MaskType != MaskType.Regex)
            {
                str = str.Replace(" ", "");
            }
            this.oldValue = str;
            if (!RadTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                editorElement.BackColor = Color.White;
            }
            editorElement.TextBoxItem.SelectAll();
            editorElement.TextChanging  += new TextChangingEventHandler(this.Editor_TextChanging);
            editorElement.ValueChanged  += new EventHandler(this.Editor_TextChanged);
            this.MaskTextBox.KeyDown    += new KeyEventHandler(this.MaskTextBox_KeyDown);
            this.MaskTextBox.KeyUp      += new KeyEventHandler(this.MaskTextBox_KeyUp);
            this.MaskTextBox.MouseWheel += new MouseEventHandler(this.Editor_MouseWheel);
            this.MaskTextBox.TextBoxItem.HostedControl.Focus();
            this.originalValue   = (object)str;
            this.selectionStart  = -1;
            this.selectionLength = -1;
        }
Пример #4
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;
        }
Пример #5
0
        public override void BeginEdit()
        {
            base.BeginEdit();
            RadSpinEditorElement editorElement = this.EditorElement as RadSpinEditorElement;

            editorElement.SetTextValueChanged(true);
            editorElement.ValueChanging += new ValueChangingEventHandler(this.spinElement_ValueChanging);
            editorElement.ValueChanged  += new EventHandler(this.spinElement_ValueChanged);
            editorElement.KeyDown       += new KeyEventHandler(this.spinElement_KeyDown);
            editorElement.KeyUp         += new KeyEventHandler(this.spinElement_KeyUp);
            if (!RadTextBoxEditor.IsDarkTheme(this.OwnerElement))
            {
                int num = (int)editorElement.SetDefaultValueOverride(VisualElement.BackColorProperty, (object)Color.White);
            }
            editorElement.TextBoxItem.SelectAll();
            editorElement.TextBoxItem.TextBoxControl.Focus();
            editorElement.RightToLeft = this.RightToLeft;
            editorElement.EnableValueChangingOnTextChanging = this.OwnerElement is GridFilterCellElement;
        }
Пример #6
0
        protected override bool ProcessEnterKey(KeyEventArgs keys)
        {
            bool isInEditMode = this.GridViewElement.IsInEditMode;

            if (!isInEditMode && this.GridViewElement.BeginEditMode == RadGridViewBeginEditMode.BeginEditOnEnter)
            {
                return(this.GridViewElement.BeginEdit());
            }
            if (isInEditMode)
            {
                RadTextBoxEditor activeEditor = this.EditorManager.ActiveEditor as RadTextBoxEditor;
                if (activeEditor != null && activeEditor.AcceptsReturn)
                {
                    return(false);
                }
            }
            if (this.GridViewElement.NewRowEnterKeyMode == RadGridViewNewRowEnterKeyMode.None)
            {
                if (isInEditMode)
                {
                    this.GridViewElement.CloseEditor();
                }
                return(true);
            }
            GridViewNewRowInfo currentRow1 = (GridViewNewRowInfo)this.GridViewElement.CurrentRow;

            if (this.GridViewElement.NewRowEnterKeyMode == RadGridViewNewRowEnterKeyMode.EnterMovesToNextCell)
            {
                bool flag = !this.IsInEditMode;
                if (isInEditMode)
                {
                    if (this.IsOnLastCell())
                    {
                        currentRow1?.DeferUserAddedRow();
                        flag = this.GridViewElement.EndEdit();
                        if (currentRow1.RowPosition == SystemRowPosition.Bottom)
                        {
                            this.GridViewElement.UpdateLayout();
                            currentRow1.EnsureVisible();
                            this.Navigator.SelectFirstColumn();
                            flag = false;
                        }
                    }
                    else
                    {
                        flag = this.GridViewElement.CloseEditor();
                    }
                }
                if (flag)
                {
                    this.Navigator.SelectNextColumn();
                }
                currentRow1?.RaiseUserAddedRow();
                if (isInEditMode && this.GridViewElement.CurrentRow is GridViewNewRowInfo && this.GridViewElement.BeginEditMode != RadGridViewBeginEditMode.BeginEditProgrammatically)
                {
                    return(this.GridViewElement.BeginEdit());
                }
                return(false);
            }
            if (this.GridViewElement.NewRowEnterKeyMode == RadGridViewNewRowEnterKeyMode.EnterMovesToLastAddedRow)
            {
                currentRow1.MoveToLastRow = true;
            }
            if (!isInEditMode)
            {
                RowValidatingEventArgs args = new RowValidatingEventArgs((GridViewRowInfo)currentRow1);
                this.MasterTemplate.EventDispatcher.RaiseEvent <RowValidatingEventArgs>(EventDispatcher.RowValidating, (object)this, args);
                if (args.Cancel)
                {
                    return(false);
                }
                currentRow1?.DeferUserAddedRow();
                currentRow1.EndAddNewRow();
            }
            else
            {
                currentRow1?.DeferUserAddedRow();
                if (!this.GridViewElement.EndEdit())
                {
                    return(false);
                }
            }
            if (this.GridViewElement.NewRowEnterKeyMode == RadGridViewNewRowEnterKeyMode.EnterMovesToNextRow)
            {
                if (currentRow1.PinPosition == PinnedRowPosition.Bottom)
                {
                    this.EnsureLastRowVisible(currentRow1);
                }
                else if (currentRow1.RowPosition == SystemRowPosition.Bottom)
                {
                    this.GridViewElement.UpdateLayout();
                    currentRow1.EnsureVisible();
                }
                else
                {
                    EventDispatcher eventDispatcher = currentRow1.ViewTemplate.MasterTemplate.EventDispatcher;
                    eventDispatcher.SuspendEvent(EventDispatcher.CellValidating);
                    eventDispatcher.SuspendEvent(EventDispatcher.CellValidated);
                    eventDispatcher.SuspendEvent(EventDispatcher.RowValidating);
                    eventDispatcher.SuspendEvent(EventDispatcher.RowValidated);
                    GridViewRowInfo currentRow2;
                    GridViewRowInfo currentRow3;
                    do
                    {
                        currentRow2 = ((BaseGridNavigator)this.Navigator).MasterTemplate.CurrentRow;
                        this.Navigator.SelectNextRow(1);
                        currentRow3 = ((BaseGridNavigator)this.Navigator).MasterTemplate.CurrentRow;
                    }while (!(currentRow3 is GridViewDataRowInfo) && !(currentRow3 is GridViewGroupRowInfo) && currentRow3 != currentRow2);
                    eventDispatcher.ResumeEvent(EventDispatcher.CellValidating);
                    eventDispatcher.ResumeEvent(EventDispatcher.CellValidated);
                    eventDispatcher.ResumeEvent(EventDispatcher.RowValidating);
                    eventDispatcher.ResumeEvent(EventDispatcher.RowValidated);
                }
            }
            currentRow1?.RaiseUserAddedRow();
            return(false);
        }