Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
390
Problem with UltraCombo as column headers - can't select items
posted

Hi,

I am using a creation filter to overlay an UltraCombo for all column headers in a grid.  I am experiencing the same problem as this post: http://es.infragistics.com/community/forums/p/43867/239732.aspx.  The UltraCombo is appearing in the column header but the drop down does not open and allow me to select items.  I have attached my creation filter code and a screen shot of the grid.

The UltraCombo allows me to set the SelectedRow and/or Text property fine.  However, setting different Appearance properties in the creation filter has no effect (ie, combo.Appearance.ForeColor = Color.Indigo; below).

What am I missing?  Any ideas?  Thanks!

Here is the code:

internal class HeaderComboBoxCreationFilter : IUIElementCreationFilter

    {

        public void AfterCreateChildElements(UIElement parent)

        {

            if (parent is HeaderUIElement)

            {

                EditorWithComboUIElement comboBoxUIElement = null;

                UltraGridComboEditorOwner embeddableEditor = null;

                EditorWithCombo editor = null;

                UltraCombo combo = null;

 

                combo = new UltraCombo();

                embeddableEditor = new UltraGridComboEditorOwner(combo);

                editor = new EditorWithCombo(embeddableEditor);

                comboBoxUIElement = new EditorWithComboUIElement(parent, embeddableEditor, editor, null, true, true, true, true);

 

                combo.DataSource = CreateColumnDataTable();

                combo.DisplayMember = "name";

                combo.ValueMember = "value";

                //combo.Text = "Text1";

                combo.SelectedRow = combo.Rows[0];

                combo.Appearance.ForeColor = Color.Indigo; // this does not have an effect

                combo.DropDownStyle = UltraComboStyle.DropDown;

                combo.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always;

 

                comboBoxUIElement.Rect = parent.Rect;

               

                parent.ChildElements.Add(comboBoxUIElement);            

            }          

        }

 

        private DataTable CreateColumnDataTable()

        {

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("name", typeof(string));

            dataTable.Columns.Add("value", typeof(string));

 

            dataTable.Rows.Add(new object[] { "Name1", "Value1" });

            dataTable.Rows.Add(new object[] { "Name2", "Value2" });

            dataTable.AcceptChanges();

 

            return dataTable;

        }

 

        public bool BeforeCreateChildElements(UIElement parent)

        {

            return false;

        }

    }

ComboBoxAsColumnHeaders.zip