Hi All,
Is it possible to add multiple columns to the dropdown of an UltraComboEditor? I know that it can be done for an UltraCombo object by adding a band to its DisplayLayout.BandSerializer collection but I can't see any obvious way of doing this for an UltraComboEditor.
Thanks in advance,
Denis
You might just have to assign an instance of that class to the grid's CreationFilter property, but I haven't confirmed that no other modifications are necessary.
I have created this class and set the CreationFilter property of my UltraCombo object to a new instance of this class, however when I attempt to embed the control in a grid I get the following runtime error:
"Unable to cast object of type Infragistics.Win.UltraWinGrid.DataAreaUIElement to type Infragistics.Win.EditorWithComboUIElement"
Do I need to set some property of the grid to enable this to work?
Thanks for this Brian. I've tried using this in my code but I dont think I am using it correctly as the dropdown button is not being removed. I have the following piece of code in my custom class constructor, the class uses UltraCombo as its base class..
<code>
UltraComboUIElement^ editorElement = UIElement;if (editorElement != nullptr)
{ Infragistics::Win::Misc::DropDownButtonUIElement^ dropDownButtonElement = (Infragistics::Win::Misc::DropDownButtonUIElement^)editorElement->GetDescendant(Infragistics::Win::Misc::DropDownButtonUIElement::typeid);
Infragistics::Win::EditorWithTextUIElement^ textElement = (Infragistics::Win::EditorWithTextUIElement^)editorElement->GetDescendant(Infragistics::Win::EditorWithTextUIElement::typeid);
if (dropDownButtonElement != nullptr && editorElement->ChildElements->Contains(dropDownButtonElement)) { editorElement->ChildElements->Remove(dropDownButtonElement); if (textElement != nullptr) { textElement->Rect = editorElement->RectInsideBorders; } }
}
</code>
I think the problem has to do with the first line 'UltraComboUIElement^ editorElement = UIElement;', UIElement is the UIElement of the UltraCombo base object but I'm not sure if this is the correct thing to do??
The following code sample demonstrates how to solve this problem for the UltraCombo or UltraComboEditor control using the IUIElementCreationFilter interface:
using Infragistics.Win;
#region NoDropDownButtonCreationFilter/// <summary>/// Prevents the dropdown button from appearing for an EditorWithComboUIElement/// </summary>public class NoDropDownButtonCreationFilter : IUIElementCreationFilter{ #region IUIElementCreationFilter Members
void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { EditorWithComboUIElement editorElement = parent as EditorWithComboUIElement;
if ( editorElement != null ) { DropDownButtonUIElement dropdownButtonElement = editorElement.GetDescendant( typeof(DropDownButtonUIElement) ) as DropDownButtonUIElement;
EditorWithTextUIElement textElement = editorElement.GetDescendant( typeof(EditorWithTextUIElement) ) as EditorWithTextUIElement;
if ( dropdownButtonElement != null && editorElement.ChildElements.Contains(dropdownButtonElement) ) { editorElement.ChildElements.Remove( dropdownButtonElement );
if ( textElement != null ) textElement.Rect = editorElement.RectInsideBorders; } } }
bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { return false; }
#endregion}#endregion NoDropDownButtonCreationFilter
I don't actually want to hide the dropdown at all, just the dropdown button. When the user types text into the edit portion I want the UltraCombo multi-column to drop down as normal, however when the user presses the dropdown button I want a different custom built form to display and not the dropdown.
I've had no luck in achieving this so far so I think I'm just gonna have to use a standard TextBox as the editor with a button added to it and build the multicolumn dropdown myself.