Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable free text for ComboBox in UWP

Tags:

I have added a ComboBox in a UWP app that I am working on for Windows 10 and I am not able to make it so that users can type in free text if the value they need on it doesn't match any of the values available to select.

How can I do this?

According to MSDN, the description for ComboBox.IsEditable is:

Gets or sets a value that enables or disables editing of the text in text box of the ComboBox.

Which seems to be what is needed. However, this seems to be only for WPF.

It does not seem to have a settable IsEditable property on XAML:

IsEditable in XAML

On the code behind, when I try to access this property, it shows that the property only has get and that it always returns false:

IsEditable in code behind

Please let me know how I could make this possible. Thank you!

like image 294
slayernoah Avatar asked Feb 22 '18 22:02

slayernoah


1 Answers

I have not tried yet but here is an implementation of ComboBox with editable textbox on UWP.

ComboBox with Editable Textbox

And, basically, Autosuggest option is totally different one from editable ComboBox - Autosuggest just suggest the candidate from the current item list, but not accept to entering the new one. To implement it, you need to implement the custom user control like the above guy.

Added Oct 2018 - From Windows 10 October 2018 Update, ComboBox now have the IsEditable property. Wao! Not well-documented yet but this blog post is helpful.

XAML ComboBox IsEditable and Text Properties

like image 54
Mamoru Satoh Avatar answered Sep 23 '22 14:09

Mamoru Satoh