Preview

image

  • Multiple selections
  • Icons and Images
  • Scrollbar support

Usage

// create the control
ListBox myListBox = new ListBox(new Rectangle(50, 50, 100, 200));

// set some properties
myListBox.MultipleSelection = true;
myListBox.SelectedItemColor = Color.Tomato;
myListBox.ShowIcons = true;

// add items to a list
myListBox.Items.Add("First");
myListBox.Items.Add("Second");
myListBox.Items.Add("Third");

// add icons (only valid if ShowIcons is set to true)
myListBox.Icons.AddRange(new Texture2D[] { guiManager.Theme.IconHome, guiManager.Theme.IconQuestion, guiManager.Theme.IconFile });

// handle item selection
myListBox.OnSelectItem += (sender, itemIndex) =>
    {
        string selectedItemName = myListBox.Items[itemIndex];
    };


// add control to a Window
myWindow.Controls.Add(myListBox);

Last edited Apr 4, 2012 at 1:42 AM by qisur, version 3

Comments

No comments yet.