Hello!
I have a little skills in Infragistics components and controls, and I have a problem...
I need add combobox at the ultragrid column header.
I do this:
1. I'm create new class, which implements IUIElementCreationFilter interface
public void AfterCreateChildElements(UIElement parent)
{
if (parent is HeaderUIElement)
HeaderBase aHeader = ((HeaderUIElement)parent).Header;
if (aHeader.Caption == "Money")
TextUIElement aTextUIElement;
EditorWithComboUIElement aComboBoxUIElement = (EditorWithComboUIElement)parent.GetDescendant(typeof(EditorWithComboUIElement));
UltraGridComboEditorOwner embeddableEditor = null;
EditorWithCombo editor = null;
UltraCombo combo = null;
if (aComboBoxUIElement == null)
combo = new UltraCombo();
embeddableEditor = new UltraGridComboEditorOwner(combo);
editor = new EditorWithCombo();
aComboBoxUIElement = new EditorWithComboUIElement(parent, embeddableEditor, editor, null, true, true, true, true);
}
else
combo = aComboBoxUIElement.Owner.GetControl(null) as UltraCombo;
embeddableEditor = aComboBoxUIElement.Owner as UltraGridComboEditorOwner;
editor = aComboBoxUIElement.Editor as EditorWithCombo;
combo.DataSource = _courses;
combo.DisplayMember = "VchCode";
combo.ValueMember = "Vcode";
combo.SelectedRow = combo.Rows[0];
aTextUIElement = (TextUIElement)parent.GetDescendant(typeof(TextUIElement));
if (aTextUIElement == null)
return;
ColumnHeader aColumnHeader = (ColumnHeader)aComboBoxUIElement.GetAncestor(typeof(HeaderUIElement)).GetContext(typeof(Infragistics.Win.UltraWinGrid.ColumnHeader));
aComboBoxUIElement.Editor.ValueChanged += new EventHandler(Editor_ValueChanged);
parent.ChildElements.Add(aComboBoxUIElement);
aComboBoxUIElement.Rect = new Rectangle(parent.Rect.X + 3, parent.Rect.Y + (parent.Rect.Height - aComboBoxUIElement.Owner.GetControl(null).Height) - 3, parent.Rect.Width - 6, aComboBoxUIElement.Owner.GetControl(null).Height);
aTextUIElement.Rect = new Rectangle(aTextUIElement.Rect.X, aTextUIElement.Rect.Y + 2, aTextUIElement.Rect.Width, 18); // 18 - height of aTextUIElement.Rect... it's bad code...
// In this case, i dont't know how i can widen columns header, if it height less than sum // of aComboBoxUIElement and aTextUIElement height...
if (aHeader.Height <= aComboBoxUIElement.Rect.Height + aTextUIElement.Rect.Height)
aHeader.Band.ColHeaderLines = aHeader.Band.ColHeaderLines + 1;
EditorWithComboUIElement aCheckBoxUIElement = (EditorWithComboUIElement)parent.GetDescendant(typeof(EditorWithComboUIElement));
if(aCheckBoxUIElement != null)
parent.ChildElements.Remove(aCheckBoxUIElement);
aCheckBoxUIElement.Dispose();
public bool BeforeCreateChildElements(UIElement parent)
return false;
In result execution this code, combobox is created, but i can't select items from combobox.
Combobox in header has items, but it behaviour like readonly
P.S.: Sorry for my poor English...
This is fairly advanced coding and at a glance it looks like you are on the right track, but without being able to debug this it is difficult to speculate about the problem. If you are able, please attach a sample application, and we can step through our code and probably see why it behaves as read-only fairly quickly.