AppNotificationDuration Enumeration
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Gibt die Dauer an, für die ein AppNotification- angezeigt wird.
public enum class AppNotificationDuration
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract, 65536)]
enum class AppNotificationDuration
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract), 65536)]
public enum AppNotificationDuration
var value = Microsoft.Windows.AppNotifications.Builder.AppNotificationDuration.default
Public Enum AppNotificationDuration
- Vererbung
-
AppNotificationDuration
- Attribute
Felder
Name | Wert | Beschreibung |
---|---|---|
Default | 0 | Die Standarddauer. |
Long | 1 | Lange Dauer. |
Beispiele
Im folgenden Beispiel wird das Festlegen der Dauer in der XML-Nutzlast für eine App-Benachrichtigung veranschaulicht.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.SetDuration(AppNotificationDuration.Long)
.BuildNotification();
AppNotificationManager.Default.Show(notification);
Die resultierende XML-Nutzlast:
<toast duration='long'>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
</toast>
Hinweise
Legen Sie die Dauer für eine App-Benachrichtigung fest, indem Sie AppNotificationBuilder.SetDurationaufrufen.