We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ComboBoxAdv.Format?

Hi,

The standard winforms ComboBox has a Format event, which allows for a final say in how an item is displayed. I cannot see an equivalent on ComboBoxAdv.

Use case:
1. Bind ComboBox to a collection of enumeration values.
2. Apply [Description] attribute to enumeration members to indicate how they're displayed.
3. Use Format event to display enumeration values with their Description attribute rather than the ToString() method of the enumeration member.

Please advise.

Thanks,
Kent

3 Replies

JJ Jisha Joy Syncfusion Team November 7, 2007 01:45 PM UTC

Hi,

Thank you for posting query to us.

In ComboBoxAdv the Format event is present in ComboBoxAdv.ListBox property.
Here is the code snippets:

this.comboBoxAdv1.ListBox..Format+=new ListControlConvertEventHandler(ListBox_Format);


Please try this and let us know if this helps.
Regards,
Jisha



LC lcd November 7, 2007 03:38 PM UTC

Hi Jisha,

That doesn't seem to work. I hook up an event handler, then set up data binding, but the event handler is never invoked.

Kent


JJ Jisha Joy Syncfusion Team November 10, 2007 11:16 AM UTC

Hi,

Thank you for your update.

In order to fire the Format event of ComboBoxAdv control we have to set FormattingEnabled property to true. In Microsoft Combobox control by default this property is set to true.
Here is the code snippets:

this.comboBoxAdv1.ListBox.FormattingEnabled = true;
this.comboBoxAdv1.ListBox.Format += new ListControlConvertEventHandler(ListBox_Format);
comboBoxAdv1.DataSource = a;

Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Tools.Windows/69665/main.htm

Please try this and let me know if this helps.

Regards,
Jisha



Loader.
Live Chat Icon For mobile
Up arrow icon