combobox with command items

  • Thread starter Thread starter Abhishek
  • Start date Start date
A

Abhishek

Hi

I want to have a combobox with some commands in it and a data source.
Basically the list should look like

command1
command2
-----------
data1
data2
data3

To solve this problem i decided to derive my own combo box form
standard ComboBox control.
I exposed 2 properties in this class
1) List of CommandItems
2) ArrayList as data source

Now i tried to merge these 2 sources as 1 source and set the data
source for the base class.
I also set the DrawMode to OwnerDrawVariable and subscribed to
DrawItem event.
I thought that i would be able to draw the items on my own. This way i
am able to insert the separator between command items and the data
items.
However when i do this i am unable to set the DisplayMember of the
combobox
it doesn't work at all.
Additionaly i also am thinking even if i am able to do that it has to
be different for data list and the command list.
Any ideas on how can i achieve this ?

~Abhishek
 
Hi

I want to have a combobox with some commands in it and a data source.
Basically the list should look like

command1
command2
-----------
data1
data2
data3

To solve this problem i decided to derive my own combo box form
standard ComboBox control.
I exposed 2 properties in this class
1) List of CommandItems
2) ArrayList as data source

Now i tried to merge these 2 sources as 1 source and set the data
source for the base class.
I also set the DrawMode to OwnerDrawVariable and subscribed to
DrawItem event.
I thought that i would be able to draw the items on my own. This way i
am able to insert the separator between command items and the data
items.
However when i do this i am unable to set the DisplayMember of the
combobox
it doesn't work at all.
Additionaly i also am thinking even if i am able to do that it has to
be different for data list and the command list.
Any ideas on how can i achieve this ?

~Abhishek

See my reply in the Controls group
 
Back
Top