Esempio n. 1
0
        public void PopulateDrawableListView()
        {
            foreach (ListViewItem item in DrawableListView.Items)
            {
                DrawableListView.Items.Remove(item);
            }
            comboBox1.Items.Clear();
            DrawableListView.LargeImageList = DrawableXML.images;
            var items = new List <ListViewItem>();

            foreach (DrawableCategory category in DrawableXML.categories)
            {
                ListViewGroup group = new ListViewGroup(category.name);
                DrawableListView.Groups.Add(group);
                comboBox1.Items.Add(new ComboItem {
                    ID = category.tag, Text = category.name
                });
                foreach (DrawableItem item in category.DrawableItems)
                {
                    string[]     row      = { item.drawable, item.GroupTag, item.tag };
                    ListViewItem listItem = new ListViewItem(row);
                    listItem.Group    = group;
                    listItem.ImageKey = item.drawable;


                    items.Add(listItem);
                }
            }

            DrawableListView.BeginUpdate();
            DrawableListView.Items.AddRange(items.ToArray());
            DrawableListView.EndUpdate();

            DrawableListView.Refresh();
        }