English 中文(简体)
如何分类TcxImageCombo的物品 描述的方框
原标题:How to sort the items of a TcxImageComboBox by Description?

I ve发现,实施ComboBox的Caption<->Value List for ComboBox:

Is there a ComboBox that has Items like a TcxRadioGroup?

唯一的问题是:它拥有的是职业财产,但无工作。

因此,我如何看待TcxImageComboBox的项目?

最佳回答

快速和 d脏方法应当对大多数情况进行罚款:

function CompareItems(AFirst: TcxImageComboBoxItem; ASecond: TcxImageComboBoxItem): Integer;
begin
  Result := AnsiCompareText(AFirst.Description, ASecond.Description);
end;

procedure SortCxComboBoxItems(AItems: TcxImageComboBoxItems);
var
  I    : Integer;
  J    : Integer;
  PMin : Integer;
begin
  AItems.BeginUpdate;
  try
    // Selection Sort (http://en.wikipedia.org/wiki/Selection_sort)
    for I := 0 to AItems.Count - 1 do 
    begin
      PMin := I;
      for J := I + 1 to AItems.Count - 1 do 
      begin
        if CompareItems(AItems[J], AItems[PMin]) < 0 then begin
          PMin := J;
        end;
      end;
      if PMin <> I then 
      begin
        AItems[PMin].Index := I;
      end;
    end;
  finally
    AItems.EndUpdate;
  end;
end;
问题回答

暂无回答




相关问题
WPF Datagrid, Setting the background of combox popup

I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I ve edited the Template for a normal Combobox and it works great for selected ...

How to insert ComboBox item into ListBox? [winforms]

The question is very simple, How to insert ComboBox selected item into ListBox using c#? I have tried with this: listbox.Items.Add(combobox.SelectedItem); and some other permutations but it always ...

How do I bind a ComboBox to a one column list

I ve seen how to bind a ComboBox to a list that has columns like this: ItemsSource="{Binding Path=Entries}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=Entry}" But ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

热门标签