How to hide Item in RepositoryItemComboBox? - winforms

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

Related

ExtJS: How to group items in combo box, but then show all detail records in display text

Using ExtJS 6.x. I have the following Fiddle:
bind grouped combo box value to detail displayfield
To start with: I would like to show just a single instance of each item in the combo box instead of the multiple instances that show up for each item (thus, instead of "one" and "two" showing up multiple times, I only want these to appear once in the combo box). Is there a way to do the grouping within the viewModel to achieve this?
Assuming then that the combobox items are now grouped accordingly, I then want to show the details in the displayText area, so that for example, if I choose "one" from the combo box, the detail area would show ALL the ids associated with this, those being '1' and '2'.
I solved this, although it feels a bit kludgey:
First, I created an SQL view with the records grouped together (using a unique key of "name + code")... then, I created another SQL view where "name + code" was another field for the original table.
I then used associations in my models to link these two entities together, and thus, used data bindings to link the record selected in the combobox to a grid.

how to insert a checkbox in a word document

I want to make a list with checkbox on the left in the Word document. I don't want to use VBA macro every time.
example:
[] item1
[] item2
*[] is checkbox
Click the Developer tab and in the Controls group, click the Check Box Content Control, and then click to the right of the box.
-
This is the original link. There is too much redundant info.
office Support

Compatible value's position in an editable ComboBox

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

WPF Lambda expression "where" - elements of a List

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();

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