次の方法で共有


IXRSelector::GetSelectedItem (Compact 2013)

3/28/2014

This method retrieves the selected item from the list.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetSelectedItem(
    __out XRValue *pSelectedItem
) = 0;

Parameters

  • pSelectedItem
    [out] Pointer to an XRValue object that represents the selected item in the list.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

The object that pSelectedItem points to can be an IXRListBoxItem object or an IXRComboBoxItem object. You can retrieve the collection of items for selector objects with one of these types by calling the inherited IXRItemsControl::GetItems method.

The combo box, which inherits from IXRSelector, allows only one selected item at a time.

To retrieve the selected item, you can call IXRSelector::GetSelectedIndex to obtain the index of the selected item and pass that index to IXRSelector::GetSelectedItem.

To use any supported value type, such as a float value, you can use the helper template version of this method that XAML for Windows Embedded provides. When you supply a value type, this version automatically supplies a type-safe method that implicitly converts the returned type from a generic XRValue to the appropriate data type.

.NET Framework Equivalent

System.Windows.Controls.Primitives.Selector.SelectedItem

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRSelector
IXRSelector::SetSelectedItem