How can I implement search functionality with a prefix highlighting in a non-editable ComboBox? - wpf

I want to create combo which is only allows selection from a fixed list but has search functionality like an editable combo i.e. when you type the combo searches for items which match the prefix you typed and the text after the prefix is highlighted in the selection box.
I think I can implement the necessary logic to do the searching but I don't know how to get the highlighting to work. I guess I could compose combo items out of text blocks and use and back colour to implement highlighting but the item would somehow need to know it is being rendered in the selection box, not the drop down area.
With IsEditable=false there is some prefix search functionality but it's transient - if you don't type anything for a second or two the prefix is reset. For this to be usable the user needs to see what he has typed and edit the prefix using backspace if needed so highlighting of the prefix is important.
The combo may have many long items and I want the user to have to time find the items he wants. Setting IsEditable to true gives more or less the search behavior I want but I don't want the user to be able type text in the box which doesn't match any item.
I have looked into customizing an editable combo to only accept key presses which match items in the list and had a degree of success but I don't want the selection behaviour of an editable combo - see this question https://stackoverflow.com/questions/10442021/how-can-i-customize-an-editable-wpf-combo-to-prevent-changing-the-selected-value

ComboBox will show the first matching entry even if IsEditable="False".
The problem you have might be a fixed list with multiple entries starting with the same. For example:
AAAA
AACC
BBBB
In this case you could give each entry a unique key:
<ComboBox IsEditable="False">
<ComboBoxItem Content="AAAA" TextSearch.Text="A" />
<ComboBoxItem Content="BBBB" TextSearch.Text="B" />
<ComboBoxItem Content="AACC" TextSearch.Text="C" />
</ComboBox>
Then if you type C key AACC entry will be selected.

Related

How to hide/show ui grid rows based on search condition

So I have been struggling with a problem involving a ui-grid that I have implemented. We have a complicated search for a table where a user can search for IDs for employees and they can also search IDs for companies. There are textboxes corresponding to employee/company ID so the user knows where to start typing. Right now, I am conditionally swapping the column visibility based on where the user begins typing (employee ID hides company columns as an example). However, I need a way to also hide the company/employee rows because the columns are showing empty values and are displaying when the user has nothing in the search box.
Research: I am toggling the columns based on an answer I found where I am just changing column visibility, but it seems there is no row visibility option. However, the only row hiding functionality seems to be checking against a static value and in this case it needs to be dynamic.
I am considering just using two different grids and toggling visibility based on the search boxes typed in, but I was trying to see if I could use just one grid.
Any help would definitely be appreciated.

Codename One ComboBox how to highlighting already selected value

We are able to create ComboBox and populating data too. But we need to highlighting already saved values. Can you please suggest code for this.
Our requirement is if Combobox has 1,2,3. If I select 2 and save. We need to set the combo box value 2 in such way that when we open the Combobox need to display this 2 as highlight value along with 1,2,3 values.
Simply same as select box option selection.
I would generally recommend avoiding ComboBox altogether.
Assuming this isn't an option you will need to define a renderer and disable the OS specific 2 render mode using a theme constant:
otherPopupRendererBool=false

Disable editing on combobox but still allowing search:possible?

I don't want to allow my user to freely write everything they please on the combobox, and I know that with:
editable: false
I can make this component not editable.
However, this disables the useful search function as well! User should be still allowed to freely write in the combo in order to search for a certain field.
Is there a way to allow search but still prevent that the words used for searching become the combobox value?
You can set the forceSelection config on the combobox to true. This will prevent the user from entering any value not in the list, but the user is still able to filter the dropdown like they would in free-form comboboxes.

MS Access 2007: I cannot type in the text-box of a multi-select combobox control

If I setup a lookup for a field when designing a table (i.e. through the Lookup Wizard) and I set "Allow Multiple Values" to "Yes", a multi-select combobox (i.e. with check-boxes) is displayed in the relevant field in the "Datasheet" view of the table. My question is the following: Is the text-box component of a multi-select combobox control actually of any use? While a single-select combobox lets you type a new value that is not in the list or facilitates the auto-complete feature when typing a value that is included in the list, but the multi-select combo box prevents you from typing anything in its textbox, and that behavior doesn't seem to change via the properties of the combobox control.
The reason I need this feature is because I want to type there something not in the list, in order to trigger the control's NotInList event, so that I can update the corresponding lookup table with the new value I typed.
Thanks

ListView with Checkboxes and Editable Fields?

I have a ListView form that looks like this:
How do I make it so each cell is like an editable textbox so the user can edit the values by clicking on a cell? Like if they click on "Count" a text edit cursor should appear in-place and they should be able to type to change the value of the field (Not in a separate dialog box or text field)
The ListView is intended for flexible display of a list of items. Similar to windows explorer's ability to show icons, thumbnails, details and basic list, all from the same set of objects. If you really want to edit all of the elements in your data objects, you should probably read up on DataGridView and data-binding.

Resources