how to display most recently used list in combo box

爷,独闯天下 提交于 2019-12-24 22:51:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!