Partager via


IXRListBox (Compact 2013)

3/28/2014

This class represents a control that contains a list of selectable items.

Syntax

class IXRListBox : public IXRSelector

Inheritance Hierarchy

IXRDependencyObject

    IXRUIElement

        IXRFrameworkElement

            IXRControl

                IXRItemsControl

                    IXRSelector

                        IXRListBox

Methods

Method

Description

IXRListBox::GetItemContainerStyle

Retrieves the style that is used when XAML for Windows Embedded renders the item containers.

IXRListBox::GetSelectedItems

Retrieves the list of currently selected items for this list box control.

IXRListBox::GetSelectionMode

Retrieves the selection behavior for the list box control.

IXRListBox::ScrollIntoView

Causes an object to scroll into view in the list box.

IXRListBox::SetItemContainerStyle

Sets the style that is used when XAML for Windows Embedded renders the item containers.

IXRListBox::SetSelectionMode

Sets the selection behavior for the list box control.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

Remarks

IXRListBox contains a collection of items. More than one item in a list box is visible. IXRListBox inherits from IXRItemsControl, and you can retrieve its IXRItemCollection object by calling IXRItemsControl::GetItems. The items collection stores each object that represents a selectable item that is displayed in the list. Items in this collection can be IXRListBoxItem objects, or other types of objects such as IXRTextBlock, IXRButton, or IXRShape objects.

The IXRListBox::SetItemContainerStyle method enables you to define a visual appearance for the items in the list by supplying an IXRStyle object for this list box.

The attached properties ScrollViewer.HorizontalScrollBarVisibility and ScrollViewer.VerticalScrollBarVisibility are used to indicate whether a vertical or horizontal scroll bar should be displayed to enable the user to scroll the list. These properties can be set to either true or false. Use them if only some list items are visible in the graphical window at a time and you want to provide a scroll bar. To set an attached property, you can use the inherited method IXRDependencyObject::SetAttachedProperty.

You can define visual behaviors for list box items that are triggered when the MouseEnter, MouseLeave, GotFocus, or MouseLeftButtonDown event is raised by each item. To do this, you create a storyboard animation and call its IXRStoryboard::Begin method from inside the event handler for each item in the collection. For more information, see IXRStoryboard and IXRTimelineCollection. To define a visual behavior that is triggered when the OnLoad event is raised, you can add an event trigger by calling the inherited method IXRFrameworkElement::GetTriggers and then adding to the trigger collection for the IXRListBox object, or for the IXRListBoxItem objects in its item collection.

When you create a class instance, use an IXRListBoxPtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

You can also define a list box in Microsoft Silverlight 3 XAML. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this element in the source XAML for your application, see the ListBox Class on MSDN.

.NET Framework Equivalent

System.Windows.Controls.ListBox

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for UI Element Management