Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 1.87 KB

appnotificationcombobox_appnotificationcombobox_290278668.md

File metadata and controls

66 lines (46 loc) · 1.87 KB
-api-id -api-type
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationComboBox.#ctor(System.String)
winrt constructor

Microsoft.Windows.AppNotifications.Builder.AppNotificationComboBox.#ctor(System.String)

-description

Initializes a new instance of the AppNotificationComboBox class with the specified ID.

-parameters

-param id

The identifier for the combo box.

-remarks

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.

-see-also

-examples

The following example demonstrates the initialization of an app notification combo box.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddComboBox(new AppNotificationComboBox("combobox_id")
        .SetTitle("Select an item:")
        .AddItem("id_one", "Item one")
        .AddItem("id_two", "Item two")
        .SetSelectedItem("id_one"))
    .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>