This is a migrated thread and some comments may be shown as answers.

Winform - AutoCompleteBox - single select

1 Answer 152 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Frenske
Top achievements
Rank 1
Frenske asked on 01 Mar 2016, 07:11 PM

Hello,

I want to make use of the AutoCompleteBox so the user has a nice autocomplete feature, without him being able to input other values then the ones in the autocomplete items. I've been looking for this some time now, but it seems like in WPF and Web it's the SelectionMode property. But in my Winform project, there is no such a property.

Can you tell me if this is possible and if so, how (which winform property i need to set). I'm using latest .net, latest telerik updates etc. Control is RadAutoCompleteBox.

Thanks a lot!

best regards,

Francois

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 02 Mar 2016, 12:39 PM
Hello Francois,

Thank you for writing.

This functionality is not available in the autocomplete box. However it can be achieved by using the LostFocus event:
private void RadAutoCompleteBox1_LostFocus(object sender, EventArgs e)
{
    int lastIndex = radAutoCompleteBox1.Text.LastIndexOf(';');
    if (lastIndex == -1)
    {
        radAutoCompleteBox1.Text = "";
    }
    else
    {
        string text = "";
        foreach (var item in radAutoCompleteBox1.Items)
        {
            text += item.Text + ';';
        }
        radAutoCompleteBox1.Text = text;
    }
}

Let me know if I can assist you further.
 
Regards,
Dimitar
Telerik

Tags
AutoCompleteBox
Asked by
Frenske
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or