語言

AppNotificationComboBox 類別

定義

代表一個組合框,會在應用程式通知中顯示。

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
繼承
Object Platform::Object IInspectable AppNotificationComboBox
屬性

範例

以下範例示範如何在 XML 有效載荷中加入應用程式通知的組合盒。

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

若支援緊急情境,所得 XML 有效載荷如下:

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

備註

透過呼叫 AppNotificationBuilder.AddComboBox 為應用程式通知加入 XML 有效載荷的組合盒。 單一應用程式通知最多可新增 5 個輸入。

建構函式

名稱 Description
AppNotificationComboBox(String)

初始化一個新的 AppNotificationComboBox 類別實例,並指定 ID。

屬性

名稱 Description
Items

取得或設定 AppNotificationComboBox 的項目

SelectedItem

取得或設定選中的項目,進入應用程式通知組合框。

Title

取得或設定應用程式通知組合框的標題。

方法

名稱 Description
AddItem(String, String)

將項目加入 AppNotificationComboBox。

SetSelectedItem(String)

設定所選項目進入應用程式通知組合框。

SetTitle(String)

設定應用程式通知組合框的標題。

適用於