Home Forums WinForms controls Xceed Grid for WinForms How can I choose items in a ComboBoxEditor by typing more than one character?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #17771 |

    I have a ComboBoxEditor that has a list of people’s names and I’d like to be able to select an item by typing a few characters of the first part of the displayed name, however each key press selects a name that starts with the last letter pressed.

    The default behaviour is to cycle through items that start with the character pressed eg: If the 3 available Replacements are: “Bloggs”, “Barry” and “Lloyd”.

    If I press “b” repeatedly the selection alternates between Bloggs and Barry. I’d like to be able to type “bl” and select Bloggs immediately, but instead it selects “Lloyd” as soon as the “l” is pressed.

     Is there any way to create this behaviour? Perhaps some sort of timeout after the last keypress before matching up the entered string?

      My ComboBoxEditor is created like this:

    gridPlayers.Columns[“Replacement”].CellEditorManager = BuildReplacementCellComboEditor();

    private CellEditorManager BuildReplacementCellComboEditor()
    {
        var editor = new ComboBoxEditor();
        editor.Columns.Add(new ColumnInfo(“Image”, typeof (Bitmap), 15));
        editor.Columns.Add(new ColumnInfo(“Name”, typeof(PlayerReplacement), 30));
        editor.ValueMember = “Name”;
        editor.DisplayFormat = “%Name%”;

        // Add blank entry at top to aid de-selecting a Replacement
        editor.Items.Add(null, new PlayerReplacement(0, “”, “”));

        foreach (var replacement in _playerReplacements)
        {
            Bitmap image = replacement.Id >= 10 ? Resources.pawn_glass_red : Resources.pawn_glass_blue;
            editor.Items.Add(image, replacement);
        }

        return editor;
    }

     

    Thanks for your help…

     

     

     

    Imported from legacy forums. Posted by Francis (had 2 views)

    Fawzi [Xceed]
    Member
    Post count: 722

    Hi Francis,

     

    Unfortunately, there is no built-in mechanism which allows to achieve what you are looking for.

    Imported from legacy forums. Posted by Fawzi [Xceed] (had 73 views)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.