AppNotificationButton 類別

定義

表示顯示在代理程式更新上的按鈕。

public ref class AppNotificationButton sealed
/// [Windows.Foundation.Metadata.Activatable(Microsoft.Windows.AppNotifications.Builder.IAppNotificationButtonFactory, 65536, "Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract")]
/// [Windows.Foundation.Metadata.Activatable(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 AppNotificationButton final
[Windows.Foundation.Metadata.Activatable(typeof(Microsoft.Windows.AppNotifications.Builder.IAppNotificationButtonFactory), 65536, "Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract")]
[Windows.Foundation.Metadata.Activatable(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 AppNotificationButton
function AppNotificationButton(content)
Public NotInheritable Class AppNotificationButton
繼承
Object Platform::Object IInspectable AppNotificationButton
屬性

範例

下列範例示範如何將按鈕新增至代理程式更新的 XML 承載。

var notification = new AppNotificationBuilder()
    .AddText("Send a message.")
    .AddTextBox("textBox")
    .AddButton(new AppNotificationButton("Send")
        .AddArgument("action", "sendMessage"))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

產生的 XML 承載:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Send a message.</text>
        </binding>
    </visual>
    <actions>
        <input id='textBox' type='text'/><action content='Send' arguments='action=sendMessage'/>
    </actions>
</toast>

備註

呼叫 AppNotificationBuilder.AddButton,將按鈕新增至代理程式更新的 XML 承載。 最多可以新增 5 個按鈕至單一代理程式更新。

如需使用 AppNotificationBuilder API 建立代理程式更新 UI 的指引,請參閱 代理程式更新內容

如需代理程式更新之 XML 架構的參考資訊,請參閱 代理程式更新內容架構

建構函式

AppNotificationButton()

初始化 AppNotificationButton 類別的新實例。

AppNotificationButton(String)

使用指定的按鈕文字,初始化 AppNotificationButton 類別的新實例。

屬性

Arguments

取得或設定與 AppNotificationButton相關聯的引數。

ButtonStyle

取得或設定按鈕的樣式。

Content

取得或設定 AppNotificationButton的按鈕文字。

ContextMenuPlacement

取得或設定值,指定按鈕是否顯示在代理程式更新操作功能表內。

Icon

取得或設定 AppNotificationButton的圖示。

InputId

取得或設定 AppNotificationButton的輸入識別碼。

InvokeUri

取得或設定按一下代理程式更新按鈕時啟動的 URI。

TargetAppId

取得或設定按一下代理程式更新按鈕時,應用程式啟動的 PFN) 套件系列名稱 (。

ToolTip

取得或設定代理程式更新按鈕的工具提示文字。

方法

AddArgument(String, String)

將由索引鍵/值組組成的引數新增至代理程式更新按鈕的 XML 承載。

IsButtonStyleSupported()

傳回值,指出目前裝置上的代理程式更新按鈕是否支援按鈕樣式。

IsToolTipSupported()

傳回值,指出目前裝置上的代理程式更新按鈕是否支援工具提示。

SetButtonStyle(AppNotificationButtonStyle)

設定代理程式更新按鈕的按鈕樣式。

SetContextMenuPlacement()

要求將代理程式更新按鈕放在通知的操作功能表中。

SetIcon(Uri)

設定 AppNotificationButton的圖示。

SetInputId(String)

設定 AppNotificationButton的輸入識別碼。

SetInvokeUri(Uri)

設定按一下代理程式更新按鈕時所啟動的 URI。

SetInvokeUri(Uri, String)

設定按一下代理程式更新按鈕時所啟動的 URI,並提供的套件系列名稱 (PFN) 來厘清。

SetToolTip(String)

設定代理程式更新按鈕的工具提示文字。

適用於