My project contains some (Comboboxes with Checkboxes) binging to the same Observable Collection.
If I checked an Item from the Main Combobox I should filter/update the information from the other combo
TmpFilter.Where(m => m.CarID == "MINI").ToList();
And there is no problem, but if the user checks more than one option ("MINI", "AUDI" ... ), a list of options. I dont know how to make the query.
Can you please help me?
You can store the list of selected items from first combobox -
List<string> selectedItems;
And can check if item is present in the list using simple query -
TmpFilter.Where(m => selectedItems.Contains(m.CarID)).ToList();
Related
Hi I am using devExpress on winform.
I have a list of items wholeList = {Item1, Item2, Item3, Item4,Item5,Item6},
and I have another two lists: ActionAList = {Item1, Item3, Item5}, ActionBList = {Item2, Item4, Item6}.
I have a grid view on my form. And I have two columns "Action" and "Item" on this grid. Each column has a repositoryItemComboBox as in-place editor.
In the dropdown of "Action", I have "ActionA" and "ActionB". In the dropdown of "Item", I have all the 6 items Item1 to Item6. When I select ActionA, I want Item dropdown only displays Item1, Item3, and Item5. The same when I select ActionB, I want Item dropdown only displays Item2, Item4 and Item6.
I think when user selects different Action (either A or B), I can clear the repositoryItems in Item dropdown, and add either ActionAList or ActionBList back to repositoryItem. But I feel uncomfortable, because it is possible at this point of time, the available items in Item dropdown are only Item1,3 and 5, but another row may still keep ActionB and Item2.
I wonder what would be the best way to archive this requirement.
I also think of whether we have any method to hide some items in the whole list.
So when the user open the editor of Item dropdown. According to the current row's action value, I may just display items in ActionAList or in ActionBList. But I am not able to find such property when I create ComboBoxItem or ImageComboBoxItem.
Thanks for any input!
Firstly, please remember that repositoryItems are only templates to construct editors for each row in GridView. The only way to control editors on cell basis is handling CustomRowCellEdit event (where you can choose existing editor or create custom editor).
Secondly, you have to handle CellValueChanged event to clear column 'Item' every time the user changes value in column 'Action' in order to avoid situation you've described (Item from ActionBList when Action = A).
Regards,
Maciej Nowicki
I have a ComboBox implemented with an auto-completion system. My ComboBox contains more than 100 items. When users are typing text in, the auto-completion system opens the dropdown list and highlights the most relevant item. Moreover, when the dropdown list is expanded, all items are available (no filters). But the most relevant item is always at the bottom of the dropdown list.
I would like it to be in the middle, if possible. One item can have the same reference but another type than another one, that's why I need to see most of them in my dropdown by placing them in the middle.
Any idea ? It's not really important but kind of useful for them. Thanks !
Update :
Here's my ComboBox with the open dropdown. Sorry about that, I had to blur its elements. As you can see, the user starts writting the reference in the ComboBox. The autocompletion works fine, but the corresponding item is found at the end of the dropdown list (in the red frame), almost out of bounds.
I wish it would be highlighted in the middle of my dropdown list instead of so far below.
Your item search may work well, but your list isn't visually filtered, which means it's size always remains the same.
It's scrolled into view, by the wpf system, but still displaying all other items around the relevant one. The reason why it's at the bottom is because wpf Scrollviewer just finished scrolling the item into view and sees no need to scroll it further into the middle.
You could use the CollectionViewSource class. Why ?
It's simple to use, will keep your viewmodel data as it is, and you would have your relevant completion item at the top. It can be obtained by GetDefaultView(..)
Let's say you have a viewmodel flag "IsHidden", stating that it's content does not match the user input:
ICollectionView cv= CollectionViewSource.GetDefaultView(myComboBox.ItemsSource);
// switch filter on
cv.Filter = obj => (obj as myViewModel).IsHidden == false;
// switch off
cv.Filter = null
I have a list box that is bound to an Observable Collection , when I the user add any new items to it it doesn't update itself until the app is closed and opened again.
(I serializes the content of the item source of this list and store it in Isolated Storage)
The only possible solution until now is to set the item source after adding the item in every method that allow the user to add any item but this isn't possible while adding from other pages as I can't access UI elements directly. Any help ?
I solved it ! In the Deserialize method I was pointing to another list (the one that has the result to Deserialization) and that damaged the binding.
I have 2 combobox
1. with items ['item1','item2]
2. is empty.
I need to add different list depend on which value from list 1 is selected.
I tried to create 2 arraystore and bind them to list2 on list1 select event it is working fine if add id to list 2 (to be able to use Ext.getCmp).
However : i used these element in an ext window and after close it, it cant be reopened because of list2 id will be duplicated.. (the window suppose to be an 'add new user popup', so thats a problem).
I need a way either get rid of the duplicated id. (I tried remove all window element with no luck)
Or be able to replace the list items. May be with some parameterized store?
Make sure your window config has
closeAction: 'destroy'
and then as a precaution you can delete the combo before the window is closed by tweaking your listeners config on the window:
listeners: {
'beforeclose' : function() {
Ext.getCmp('idOfCombo').destroy();
}
}
I have been searching for a while now, and have not been able to find a load-on-demand combo box that populates itself depending on what is typed in the combo-box.
I also have a requirement that an item in the list must be selected (i.e.: free text can be entered but not "selected" - only a "search result" can be selected from the list in the combo box.
The scenario is as follows : there is a text box/combo box where someone enter the first 2 or 3 characters, a web service is called which queries a database and then populates the combo box.
Are there any controls or code example that anyone knows of? Or alternatively another way to implement this?
Here is a link to an asp.net control that has this functionality:
http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx
use the event "textchanged" to dynamicly add/remove items :)
updated :
why not bind the results to observable collection and databind that to the combo box , so on chnage > query database > bind items to the collection , .net automatilcy updates the items , this might work :)
Telerik combobox with autocomplete will be what you are looking for.