Share via


AppNotificationComboBox Class

Definition

Represents a combo box that is displayed on an app notification.

public ref class AppNotificationComboBox sealed
/// [Windows.Foundation.Metadata.Activatable(Microsoft.Windows.AppNotifications.Builder.IAppNotificationComboBoxFactory, 65536, "Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class AppNotificationComboBox final
[Windows.Foundation.Metadata.Activatable(typeof(Microsoft.Windows.AppNotifications.Builder.IAppNotificationComboBoxFactory), 65536, "Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class AppNotificationComboBox
function AppNotificationComboBox(id)
Public NotInheritable Class AppNotificationComboBox
Inheritance
Object Platform::Object IInspectable AppNotificationComboBox
Attributes

Examples

The following example demonstrates adding a combo box to the XML payload for an app notification.

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>

Remarks

Add a combo box to the XML payload for an app notification by calling AppNotificationBuilder.AddComboBox). Up to 5 inputs may be added to a single app notification.

Constructors

AppNotificationComboBox(String)

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

Properties

Items

Gets or sets the items for an AppNotificationComboBox

SelectedItem

Gets or sets the selected item for an app notification combo box.

Title

Gets or sets the title for an app notification combo box.

Methods

AddItem(String, String)

Adds an item to an AppNotificationComboBox.

SetSelectedItem(String)

Sets the selected item for an app notification combo box.

SetTitle(String)

Sets the title for an app notification combo box.

Applies to