Not selecting item in combobox - wpf

I need the following behavior for WPF Combobox:
i need autofilter in combobox. Took the implementation from here. But when there are several items in dropdown that are almost same-when i press DOWN it just selects the first one from list and hides others(see video of current behavior here: http://www.youtube.com/watch?v=_WYAgMTxc4M). If i want the second possible-i have to select it with mouse or write down the whole item display name in editable part of combobox. Is it possible to select item without changing editable part of the combobox, until i press ENTER, for example?

I think that problem is when you select the item, it fill the text area of ComboBox, than it notify that filter text changed and it applied new filter for the list, and the only one item remains in the list.
You should to rewrite this behavior that will apply filter only if KeyPressed / KeyDown / KeyUp events was fired.

Related

DatagridTemplateColumn.CellEdit selection changed

I have a ComboBox in a DataGridTemplateColumn.CellTemplate. When editing an existing entry the UpdateSourceTrigger=PropertyChanged fires on property change. However, I want it to fire on a new line as well just as if I have press (clicked) in any of the cell to start new entry.
By the way I am not using DataGridTemplateColumn.CellEditingTemplate for editing but DataGridTemplateColumn.CellTemplate which I thinks looks better unlike the default
In MS documentation it says DataGridCell.Selected Event Occurs when the cell is selected. That means when one presses a KeyDown or mouse click in the cell. I guess what I want is how to select a cell through a ComboxBox selection changed event. I want when I select a record in the combobox to begin the a new line just as if I have started typing soemthin in any of the DataGrid cells.

Combobox List passing string

I have a VB6 application that has been running for quite sometime. Currently I'm trying to update one of the form that has a combobox 2.0. Because the combobox is populated with hundreds of items - I'm trying to update it so that users are able to click on a look up button next to it, where another window opens up with all the items from the combobox. User will be able to search by keyword and/or select an item and double click on it and have it appear in the combobox. The issue I'm having is with trying to pass no value or "" when CANCEL is clicked. I'm able to pass the value if I in the properties window my STYLE Is set to COMBO rather than list. However, the issue I come across is that with COMBO the value (text) in the combobox sometimes is not aligned properly. Is there a way to pass a "" value to a combobox 2.0 without changing the style to COMBO?
If they hit cancel set the ListIndex of your combo to -1 rather than setting the text property. This is the value for no item being selected.

How to add a specific item as the last item of listview

I have a ListView control which is bound to a ObservableCollection, I want to add a specific button at the end of the last item, so that when user click the button, clear up the colltions, then hide the button. Also, if the collection is empty, don't like the button display. After searching, I found many solutions on how to change the last item's style, but in my scenario, the button isn't the element of the ItemsSource. Anyone can help?
Thanks
Add the button to the template so it appears on every element in the ListView. Then use a trigger to show/hide the button based on whether the item is the last item in the list.
One way to do this is to expose the last item in your list via a property on your ViewModel. The trigger should compare the DataContext of the template, which is the current item, against the LastItem. Success should set the visibility of the button.
I hope this helps.

Toggle Selected Row in WPF DataGrid

I want to be able to toggle selection when a row is clicked. So, first click should highlight it and second click (again on the row) should unhighlight it (and fire an event). Is it even possible? I'm using a OnSelectionChanged event but that gets fired only when I click on a different row than the selected one.
there a some useful answers here(searching the visual tree) or here(check in PreviewMouseLeftButtonDown).

silverlight combobox - highlight a few items in the popup list

I'm wondering if I can make fake sections in the popup menu:
The rule would be, if the 5th character of the displayed item is different from the 5th char of the previous item in the menu, it has to be highlighted
What do you think?
Thanks!
To achieve this would be a hack.
Normally the items that appear in the popup part of a combo box will be an instantiated data template, and each gets its own data item and has no clue or knowledge of the other items in the list, so you couldn't use a converter or anything else to achieve this behavior.
What you could do though is inject (attach) your own control into the popup part of the combo box, and take over the rendering of the data items. How you do this will depend upon which combo box you are using (i.e. MS or some other vendor's) and would be a whole new question.
Would that be easier if I were to create my own combobox as follow:
a TextBox associated with a Button that when pushed would popup a datagrid in which I could implement this conditional formatting?

Resources