如何在组合框中显示最近使用的列表 [英] how to display most recently used list in combo box

查看:61
本文介绍了如何在组合框中显示最近使用的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基础设施WPF编辑器和XamComboEditor。在以前的WinForms版本中,具有MRU列表功能。它的基本作用是在列表的开头显示最近使用过的项目的列表,并用一些分隔符(无法选择)将这些项目分开。在此分隔符之后是组合框项目的常规列表。

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.

现在,基础设施组合不提供此功能。我必须自己开发它,问题是如何解决这个问题。我最大的担心是如何修改当前的组合框(可以是常规的wpf框)以实际显示它。

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.

欢迎提出任何建议。

推荐答案

要处理实际的UI部分,可以使用CollectionViewSource / ICollectionView的分组和可选的排序(如果希望对MRU进行排序)来修改ComboBox的视图。集合。大多数工作将要设置特定于您的情况的数据,但是在绑定到分组的ICollectionView之后,您需要在UI中进行的所有操作都是在ComboBox上您可能需要的位置设置GroupStyle仅显示非MRU组的分隔符,而不显示MRU的分隔符。

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.

这篇关于如何在组合框中显示最近使用的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆