AppNotificationComboBox.Items Property

Definition

Gets or sets the items for an AppNotificationComboBox

public:
 property IMap<Platform::String ^, Platform::String ^> ^ Items { IMap<Platform::String ^, Platform::String ^> ^ get(); void set(IMap<Platform::String ^, Platform::String ^> ^ value); };
IMap<winrt::hstring, winrt::hstring const&> Items();

void Items(IMap<winrt::hstring, winrt::hstring const&> value);
public IDictionary<string,string> Items { get; set; }
var iMap = appNotificationComboBox.items;
appNotificationComboBox.items = iMap;
Public Property Items As IDictionary(Of String, String)

Property Value

IMap<String,String>

IDictionary<String,String>

IMap<Platform::String,Platform::String>

IMap<winrt::hstring,winrt::hstring>

A dictionary of key/value pairs representing the IDs and display text for the combo box items.

Examples

The following example demonstrates the use of this property to add items to the app notification combo box.

var comboBox = new AppNotificationComboBox("combobox_id");
comboBox.Title = "Select an item:";
comboBox.Items = new Dictionary<string, string> { { "id_one", "Item one" }, { "id_two", "Item two" } };
comboBox.SelectedItem = "id_one";

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddComboBox(comboBox)
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload if the urgent scenario is supported:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <input id='combobox_id' type='selection' title='Select an item:' defaultInput='id_one'>
            <selection id='id_one' content='Item one'/>
            <selection id='id_two' content='Item two'/>
        </input>
    </actions>
</toast>

Remarks

You can also add items to an app notification combo box by calling AppNotificationComboBox.AddItem.

For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.

For reference information about the XML schema for app notifications, see App notification content schema.

Applies to