AppNotificationComboBox Klasse

Definition

Stellt ein Kombinationsfeld dar, das in einer App-Benachrichtigung angezeigt wird.

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
Vererbung
Object Platform::Object IInspectable AppNotificationComboBox
Attribute

Beispiele

Das folgende Beispiel veranschaulicht das Hinzufügen eines Kombinationsfelds zur XML-Nutzlast für eine App-Benachrichtigung.

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);

Die resultierende XML-Nutzlast, wenn das dringende Szenario unterstützt wird:

<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>

Hinweise

Fügen Sie der XML-Nutzlast für eine App-Benachrichtigung ein Kombinationsfeld hinzu, indem Sie AppNotificationBuilder.AddComboBox aufrufen. Einer einzelnen App-Benachrichtigung können bis zu 5 Eingaben hinzugefügt werden.

Konstruktoren

AppNotificationComboBox(String)

Initialisiert eine neue instance der AppNotificationComboBox-Klasse mit der angegebenen ID.

Eigenschaften

Items

Ruft die Elemente für eine AppNotificationComboBox ab oder legt sie fest.

SelectedItem

Ruft das ausgewählte Element für ein App-Benachrichtigungskombinationsfeld ab oder legt es fest.

Title

Ruft den Titel für ein App-Benachrichtigungskombinationsfeld ab oder legt diesen fest.

Methoden

AddItem(String, String)

Fügt einem AppNotificationComboBox-Element ein Element hinzu.

SetSelectedItem(String)

Legt das ausgewählte Element für ein Kombinationsfeld für app-Benachrichtigungen fest.

SetTitle(String)

Legt den Titel für ein Kombinationsfeld für app-Benachrichtigungen fest.

Gilt für: