AppNotificationButton Classe

Définition

Représente un bouton affiché sur une notification d’application.

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
Héritage
Object Platform::Object IInspectable AppNotificationButton
Attributs

Exemples

L’exemple suivant illustre l’ajout d’un bouton à la charge utile XML pour une notification d’application.

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

AppNotificationManager.Default.Show(notification);

Charge utile XML résultante :

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

Remarques

Ajoutez un bouton à la charge utile XML pour une notification d’application en appelant AppNotificationBuilder.AddButton. Jusqu’à 5 boutons peuvent être ajoutés à une notification d’application unique.

Pour obtenir des conseils sur l’utilisation des API AppNotificationBuilder pour créer l’interface utilisateur pour les notifications d’application, consultez Contenu des notifications d’application.

Pour obtenir des informations de référence sur le schéma XML pour les notifications d’application, consultez Schéma de contenu de notification d’application.

Constructeurs

AppNotificationButton()

Initialise une nouvelle instance de la classe AppNotificationButton.

AppNotificationButton(String)

Initialise une nouvelle instance de la classe AppNotificationButton avec le texte du bouton spécifié.

Propriétés

Arguments

Obtient ou définit les arguments associés à AppNotificationButton.

ButtonStyle

Obtient ou définit le style d’un bouton.

Content

Obtient ou définit le texte de bouton d’un AppNotificationButton.

ContextMenuPlacement

Obtient ou définit une valeur spécifiant si le bouton est affiché à l’intérieur du menu contextuel de notification d’application.

Icon

Obtient ou définit l’icône d’un AppNotificationButton.

InputId

Obtient ou définit l’ID d’entrée d’un AppNotificationButton.

InvokeUri

Obtient ou définit l’URI qui est lancé lorsque vous cliquez sur le bouton de notification de l’application.

TargetAppId

Obtient ou définit le nom de famille de package (PFN) de l’application à lancer lorsque vous cliquez sur le bouton de notification de l’application.

ToolTip

Obtient ou définit le texte de l’info-bulle pour le bouton de notification de l’application.

Méthodes

AddArgument(String, String)

Ajoute un argument composé d’une paire clé/valeur à la charge utile XML d’un bouton de notification d’application.

IsButtonStyleSupported()

Retourne une valeur indiquant si les styles de bouton sont pris en charge pour les boutons de notification d’application sur l’appareil actuel.

IsToolTipSupported()

Retourne une valeur indiquant si les info-bulles sont prises en charge pour les boutons de notification d’application sur l’appareil actuel.

SetButtonStyle(AppNotificationButtonStyle)

Définit le style de bouton pour le bouton de notification d’application.

SetContextMenuPlacement()

Demande que le bouton de notification d’application soit placé dans le menu contextuel de la notification.

SetIcon(Uri)

Définit l’icône d’un AppNotificationButton.

SetInputId(String)

Définit l’ID d’entrée d’un AppNotificationButton.

SetInvokeUri(Uri)

Définit l’URI qui est lancé lorsque vous cliquez sur le bouton de notification de l’application.

SetInvokeUri(Uri, String)

Définit l’URI qui est lancé lorsque vous cliquez sur le bouton de notification de l’application, avec un nom de famille de package (PFN) fourni pour lever l’ambiguïté.

SetToolTip(String)

Définit le texte de l’info-bulle pour le bouton de notification de l’application.

S’applique à