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.
Unfortunately, activation email could not send to your email. Please try again.

ComboBoxAdv.Format?

Thread ID:

Created:

Updated:

Platform:

Replies:

69665 Nov 7,2007 06:31 AM Nov 10,2007 06:16 AM Windows Forms 3
loading
Tags: Tools
lcd
Asked On November 7, 2007 06:31 AM

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

Jisha Joy [Syncfusion]
Replied On November 7, 2007 08:45 AM

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


lcd
Replied On November 7, 2007 10:38 AM

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

Jisha Joy [Syncfusion]
Replied On November 10, 2007 06:16 AM

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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;