如何:对 Windows 窗体 ComboBox 控件、ListBox 控件或 CheckedListBox 控件的内容排序How to: Sort the Contents of a Windows Forms ComboBox, ListBox, or CheckedListBox Control

Windows 窗体控件不排序操作时它们是数据绑定。Windows Forms controls do not sort when they are data-bound. 若要显示已排序的数据,请使用支持排序的数据源,然后对其进行排序的数据源。To display sorted data, use a data source that supports sorting and then have the data source sort it. 支持排序的数据源是数据的视图,数据查看管理器,并已排序数组。Data sources that support sorting are data views, data view managers, and sorted arrays.

如果控件不是数据绑定,您可以对其进行排序。If the control is not data-bound, you can sort it.

若要对列表进行排序To sort the list

  1. Sorted 属性设置为 trueSet the Sorted property to true.

    此设置按排序顺序重新定位所有现有列表项。This setting repositions all existing list items in sorted order.

请参阅See also