WPF Google-style ComboBox - AutoSuggestion - c#

I want to have a Input field where I can input a string. That string could be a new item for that field or I choose to select an existing item. So I do not want Auto-Completion, but Auto-Suggestion which allows me to add entries to the ItemsSource by typing them in.
Basically it is like a normal WPF Combobox with
IsEditable="True"
But how can I get the ComboBox to reduce the list of suggestions to the string I input?
I don't want the ComboBox to present all Items of ItemsSource for selection, but only the ones that contain the string I input.
Can I do it due just setting some ComboBox properties?

For this propose you can use open source solutions like WPF AutoComplete TextBox control or other Autocomplete solutions

For this, I use the DevExpress library. If the ComboBoxEdit is configured correctly, it will auto display a drop down list which is continuously filtered by what the user types. Make sure you set the Mode to Contains, so it matches on any part of what the user types. Users love it as they can quickly narrow down the list of items to select from.
For the record, I am not affiliated with DevExpress. I'm sure Telerik has an equally good control as well.

Related

Multiple combo boxes bound to same source with conditional visibility on items

Unlike many questions related to this, I'm not having an issue with all combo box values being changed at when changing one combo box selection.
My problem is that I want to change the visibility of certain items when they are selected in the other list. I have two input port combo boxes and when I select port 5, say, on the first one, I want port 5 to not appear in the drop down for the second combo box.
I've tried this solution How to set combox item visibility? as it looked very promising but it won't let me cast from string to ComboBoxItem in the code-behind.
What else am I to do? I thought of creating a style in the XAML itself, but I can't quite figure out the conditions to use within the XAML and can't seem to find any topics over it. Lastly, I also have conditions in the setters for my input properties to check that the value the port is being set to is not the same as the other port, but it's not seeming to do anything for the view.
Are you using an ObservableCollection? This would allow for two way data binding whereas your UI will reflect the contents of each ObservableCollection in realtime if added to or removed from in an event. In another scenario, I had to apply a custom object to bind to in order to determine whether or not to show it, however, it was not the contents of a combobox, which are harder to access.

Winforms - Combobox autocomplete doesn't show items with the same name

I have a combobox with autocomplete,
Some of my items have the same display name..
The autocomplete shows only the first one it finds...I need it to show everything that matches the text input and not just the first one.
All i can find online is people making custom autocomplete comboboxes.
all i need is for it to show all matches.
Is that possible?
Not without making a custom combobox.

How to create combobox when selected item it adds this anywhere?

How to this for combobox?I have long stackpanel which first it has only combobox.And when i select anything from combobox it will be added as button or other thing like on the picture.And it can be closed
[EDIT] I need anything on WPF
This should do the job nicely in WPF; http://www.codeproject.com/KB/WPF/MultiComboBox.aspx
The combo box that ships with WPF does not support selecting multiple
items...
This article describes a WPF combo box that supports both. It also
describes a list box, which the combo box inherits from, that supports
binding to the SelectedItems
Alternatively: WPF: ComboBox with CheckBoxes as items (it will even update on the fly!)
Recently I’ve come across something weird… I needed a ComboBox that will allow the user to select multiple items.
The the solution coming to mind is using CheckBoxes. I have found several examples, but neither one displayed the selected items with pretty commas like this;
i m not sure what you are asking for but you can use this.
jquery tokenizing
what about this?
jQuery Chosen Plugin
http://davidwalsh.name/dw-content/jquery-chosen.php

C# ComboBox for IP addresses

I need a custom combo box that holds IP addresses. I have a custom control that holds an IP address(that actually is a panel with 4 textboxes). I already tried adding other controls to a normal combo box, such as a button and a textbox. I get no exceptions but I would expect to see the item in the drop-down list, instead i get a blank line for each item.
My first thoughts about this would be to extend the ComboBox control. What would you suggest?
A combo box is basically a textbox and a (usually) button-activated listbox combined for convenience. If it's not convenient you could implement your own dropdown functionality. Put a button next to your textboxes that display a listbox and when an item is selected from the listbox, put the values in the appropriate textboxes. In other words, don't try to extend the combo box, try to re-construct a similar control based on similar components.
It's not too difficult to override the ComboBox so I suppose you could create a custom ComboBox to show your own control that would be a container showing multiple of your IP Address controls.
Here's a blog article by JaredPar showing how to get started, just replace the m_form with your own custom container control.
You can hold the ip-addresses in a listbox, even in a combobox or what ever you want. Do not forget how your coding is, if you have an oop based tcp-socket program than no cross thread exception will be thrown. the codes shall be like ListBox.Items.Add(ipaddress) or ComboBox.Items.Add(ipaddress) ...
In controls you may hold only the ip-addresses, if you want to store the socket objects use Dictionary ... Your answer is not clear, so i've answered on possibly situations.

Cloning the WPF ComboBox control: Ideas or suggestions

If have a control that acts like a record selector from a database, say, for example, customers.
The control must act in certain ways allowing the user to type the name, the alias or the code of the customer, and the control will select the correct one, or offer a list of possible candidates, and other behaviors.
I have tried to inherit from ComboBox, but there are some ComboBox behaviors that make it difficult or impossible to do what I want, so I'm better starting from scratch, with a TextBox and Button.
The questions are:
Do you know some open-source component so I don't have to start from zero?
Have you already done something like this and want to share methodologies or tips?
Am I good with a TextBox, a Button and a PopUp control?
Try this control from CodeProject: A Reusable WPF Autocomplete TextBox
It allows you to specify a source list, and a custom filter. In your custom filter you can select to show only those records that have a name, alias or code that fit the text entered, and the user will have a list of filtered options displayed to them.

Categories