Ejemplo n.º 1
0
        private void SetupColorComboBoxes()
        {
            // add colors starting with the letter A
            ColorsComboBox1.DataSource = ColorsBeginningWith("A");

            // add colors starting with B, will not show up
            var bColors = ColorsBeginningWith("B");

            ((List <nf.ColorItem>)ColorsComboBox1.DataSource).AddRange(bColors.ToArray());

            /*
             * We need to use a BindingList to allow a ComboBox to recognize new
             * items added.
             */
            var bColorList = new BindingList <nf.ColorItem>(ColorsBeginningWith("A"));

            ColorsComboBox2.DataSource = bColorList;
            bColorList.AddColors(bColors);
        }