public virtual void OnKeyUp(KeyEventArgs e)
        {
            RadDropDownListEditorElement editorElement = this.EditorElement as RadDropDownListEditorElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            bool flag   = editorElement.DropDownStyle == RadDropDownStyle.DropDown;
            int  length = editorElement.Text.Length;

            switch (e.KeyCode)
            {
            case Keys.Left:
                if (flag && (!this.RightToLeft || this.selectionStart != length) && (this.RightToLeft || this.selectionStart != 0))
                {
                    break;
                }
                base.OnKeyDown(e);
                break;

            case Keys.Right:
                if (flag && (!this.RightToLeft || this.selectionStart != 0) && (this.RightToLeft || this.selectionStart != length))
                {
                    break;
                }
                base.OnKeyDown(e);
                break;
            }
        }
        public override void OnKeyDown(KeyEventArgs e)
        {
            RadDropDownListEditorElement editorElement = this.EditorElement as RadDropDownListEditorElement;

            if (editorElement == null || !editorElement.IsInValidState(true))
            {
                return;
            }
            this.selectionStart = editorElement.SelectionStart;
            if (e.KeyCode == Keys.Return && e.Modifiers != Keys.Control)
            {
                base.OnKeyDown(e);
            }
            else if (e.KeyCode == Keys.Escape)
            {
                base.OnKeyDown(e);
                e.Handled = true;
            }
            else
            {
                if (e.KeyCode != Keys.Left && e.KeyCode != Keys.Right || editorElement.DropDownStyle != RadDropDownStyle.DropDownList)
                {
                    return;
                }
                e.Handled = true;
            }
        }
Exemplo n.º 3
0
 public override AccessibleObject GetChild(int index)
 {
     if (this.owner.IsInEditMode && this.owner.CurrentRow == this.row && this.owner.CurrentColumn == this.column)
     {
         BaseGridEditor activeEditor = this.owner.ActiveEditor as BaseGridEditor;
         if (activeEditor != null)
         {
             RadElement           editorElement = activeEditor.EditorElement;
             RadSpinEditorElement editor        = editorElement as RadSpinEditorElement;
             if (editor != null)
             {
                 return((AccessibleObject) new RadGridSpinEditorElementAccessibleObject(this.owner, editor, this, editor.ControlBoundingRectangle.Size, new Point(editor.ControlBoundingRectangle.X, editor.ControlBoundingRectangle.Y), editor.Name));
             }
             RadDropDownListEditorElement listEditorElement = editorElement as RadDropDownListEditorElement;
             if (listEditorElement != null)
             {
                 if (this.dropDownListAccessibleObject != null)
                 {
                     this.dropDownListAccessibleObject.UnwireEvents();
                 }
                 this.dropDownListAccessibleObject = new GridDropDownAccessibilityObject((RadDropDownListElement)listEditorElement, this, listEditorElement.Name);
                 return((AccessibleObject)this.dropDownListAccessibleObject);
             }
         }
     }
     return(base.GetChild(index));
 }
        public override void BeginEdit()
        {
            base.BeginEdit();
            RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)this.EditorElement;

            editorElement.TextBox.TextBoxItem.TextChanged += new EventHandler(this.TextBoxItem_TextChanged);
            editorElement.SelectedIndexChanging           += new Telerik.WinControls.UI.Data.PositionChangingEventHandler(this.DropDownListElement_SelectedIndexChanging);
            editorElement.SelectedIndexChanged            += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(this.DropDownListElement_SelectedIndexChanged);
            editorElement.HandleKeyUp    += new KeyEventHandler(this.DropDownListElement_HandleKeyUp);
            editorElement.HandleKeyDown  += new KeyEventHandler(this.DropDownListElement_HandleKeyDown);
            editorElement.SelectionStart  = 0;
            editorElement.SelectionLength = editorElement.Text == null ? 0 : editorElement.Text.Length;
            editorElement.Focus();
            if (editorElement.DropDownStyle != RadDropDownStyle.DropDown)
            {
                return;
            }
            editorElement.TextBox.Focus();
        }
        public override bool EndEdit()
        {
            base.EndEdit();
            RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)this.EditorElement;

            if (editorElement.IsPopupOpen)
            {
                editorElement.ClosePopup();
            }
            editorElement.SelectedIndexChanging           -= new Telerik.WinControls.UI.Data.PositionChangingEventHandler(this.DropDownListElement_SelectedIndexChanging);
            editorElement.SelectedIndexChanged            -= new Telerik.WinControls.UI.Data.PositionChangedEventHandler(this.DropDownListElement_SelectedIndexChanged);
            editorElement.HandleKeyUp                     -= new KeyEventHandler(this.DropDownListElement_HandleKeyUp);
            editorElement.HandleKeyDown                   -= new KeyEventHandler(this.DropDownListElement_HandleKeyDown);
            editorElement.TextBox.TextBoxItem.TextChanged -= new EventHandler(this.TextBoxItem_TextChanged);
            editorElement.Filter     = (Predicate <RadListDataItem>)null;
            editorElement.DataSource = (object)null;
            editorElement.Items.Clear();
            return(true);
        }
        private void TextBoxItem_TextChanged(object sender, EventArgs e)
        {
            RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)this.EditorElement;

            if (editorElement.DropDownStyle != RadDropDownStyle.DropDown)
            {
                return;
            }
            string           text           = (sender as RadTextBoxItem).Text;
            StringComparison comparisonType = editorElement.CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase;

            if (!this.AllowItemSelection)
            {
                return;
            }
            foreach (RadListDataItem radListDataItem in editorElement.Items)
            {
                if (radListDataItem.Text.Equals(text, comparisonType))
                {
                    radListDataItem.Selected = true;
                    break;
                }
            }
        }