问题
I'm using infragistics WPF editors and XamComboEditor. In previous WinForms version there was MRU list capability. What it basically does is it displays list of most recently used items at the beginning of the list and separates those items with some separator (which cannot be selected). Regular list of combo box items follows after this separator.
Now, infragistics combo does not provide this functionallity. I'll have to develop it on my own and the question is how to approach this. My biggest concern is how to modify current combo box (it can be regular wpf one) to actually display it.
Any suggestions are welcome.
回答1:
To handle the actual UI part you can use CollectionViewSource/ICollectionView's Grouping and optionally Sorting (if you want the MRU to be ordered) to modify the ComboBox's view of the collection. Most of the work is going to be setting up the data which will be specific to your situation but all you'll need to do in the UI after you're bound to a grouped ICollectionView is set a GroupStyle on the ComboBox where you probably want to show a separator only for the non-MRU group and nothing for the MRU.
来源:https://stackoverflow.com/questions/3626797/how-to-display-most-recently-used-list-in-combo-box