Share via


LISTBOX Element

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The LISTBOX element provides a way for users to select items from a list. These items can be specified by using ITEM elements as children of the LISTBOX element. If you need a list box control that is displayed only when needed, use the POPUP element, which is identical to the LISTBOX element except for the default value of the popUp attribute, which dictates its display behavior.

The LISTBOX element supports the following attributes.

Attribute Description
backgroundColor Specifies or retrieves the background color in the list box control.
border Specifies or retrieves a value indicating whether the list box control has a border. Can only be set at design time.
firstVisibleItem Specifies or retrieves the index of the first visible line in the list box control.
focusItem Specifies or retrieves the line that contains focus.
fontFace Specifies or retrieves the font for the list box control.
fontSize Specifies or retrieves the font size for the list box control.
fontStyle Specifies or retrieves the font style for the list box control.
foregroundColor Specifies or retrieves the text color in the list box control.
itemCount Retrieves the number of items in the list box control.
multiSelect Specifies or retrieves a value indicating whether the user can select multiple lines. Can only be set at design time.
popUp Specifies a value indicating whether the element represents a popup or list box control.
readOnly Specifies or retrieves a value indicating whether text is read-only or text can be selected by the user.
selectedItem Specifies or retrieves the index of the item selected in the list box control.
sorted Specifies or retrieves a value indicating whether the list box control is sorted alphabetically.

 

The LISTBOX element supports the following methods.

Method Description
appendItem Inserts new text at the end of the list box control.
deleteAll Deletes all items from the list box control.
deleteItem Deletes the list box control item at the specified index.
dismiss Hides the control.
findItem Searches for a given string starting with the item following the specified item index.
getItem Retrieves the text for the item with the specified index.
getNextSelectedItem Retrieves the next selected item in the list box control starting at the item after the one with the specified index.
insertItem Inserts the specified text at the specified index in the list box control.
replaceItem Replaces the text at the specified index with the specified text.
setSelectedState Selects or unselects the item with the specified index.
show Displays the control.

 

Note

This element requires Windows Media Player for Windows XP or later.

 

POPUP Element

Skin Programming Reference