I'd like to use a ComboBox control that when the dropdown button is pressed will display my custom control instead of the standard ListBox control.
An example can be found in the Visual Studio Properties window when editing a form. The BackColor property is a ComboBox type of control; when the dropdown button is pressed it shows a tab control that allows you to pick a color.
Can I do this with one of the IG controls?
Thanks,- Josh
Yes, you can do this, but not really with an UltraComboEditor. The WinEditor controls support EditorButtons, which allow you to add any number of buttons to the edit area. For example, you can add a DropDownEditorButton to the UltraTextEditor's ButtonsRight collection, and assign a reference to your custom control to the DropDownEditorButton's Control property.
Example:
using Infragistics.Win;using Infragistics.Win.UltraWinEditors;
// Create a DropDownEditorButton and hook the events of interestDropDownEditorButton button = new DropDownEditorButton();button.Click += new EditorButtonEventHandler(this.OnDropDownEditorButtonClick);button.BeforeDropDown += new BeforeEditorButtonDropDownEventHandler(this.OnDropDownEditorButtonBeforeDropDown);button.AfterCloseUp += new EditorButtonEventHandler(this.OnDropDownEditorButtonAfterCloseUp);button.Control = new MyControl();
// Add the DropDownEditorButton to the UltraTextEditor's ButtonsRight collection this.ultraTextEditor.ButtonsRight.Add( button );}
private void OnDropDownEditorButtonAfterCloseUp(object sender, EditorButtonEventArgs e){ UltraTextEditor textEditor = sender as UltraTextEditor; DropDownEditorButton button = e.Button as DropDownEditorButton; // TODO: Set the UltraTextEditor's Text to the custom control's value}
private void OnDropDownEditorButtonBeforeDropDown(object sender, BeforeEditorButtonDropDownEventArgs e){ UltraTextEditor textEditor = sender as UltraTextEditor; DropDownEditorButton button = e.Button as DropDownEditorButton; // TODO: Parse the UltraTextEditor's Text and set the custom control's value}
private void OnDropDownEditorButtonClick( object sender, EditorButtonEventArgs e ){ UltraTextEditor textEditor = sender as UltraTextEditor; DropDownEditorButton button = e.Button as DropDownEditorButton;}
Thanks. That nailed it.
I used your code but it does not effect when use editor control in grid and doesn't fire any events. Please LMK how to make it work ?
You can send me something in vb.I want to study the situation to implement something.
I'm in desperate need.