AppNotificationProgressBar.BindTitle Methode
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.
Bindet die AppNotificationProgressBar.Title-Eigenschaft .
public:
virtual AppNotificationProgressBar ^ BindTitle() = BindTitle;
AppNotificationProgressBar BindTitle();
public AppNotificationProgressBar BindTitle();
function bindTitle()
Public Function BindTitle () As AppNotificationProgressBar
Gibt zurück
Gibt die AppNotificationProgressBar-Instanz zurück, sodass zusätzliche Methodenaufrufe verkettet werden können.
Beispiele
Im folgenden Beispiel wird veranschaulicht, wie die Title-Eigenschaft einer App-Benachrichtigungsstatusanzeige mithilfe der Datenbindung festgelegt wird.
var notification = new AppNotificationBuilder()
.AddText("Downloading your weekly playlist...")
.AddProgressBar(new AppNotificationProgressBar()
.BindTitle()
.BindStatus()
.BindValue()
.BindValueStringOverride())
.SetTag(tagName)
.SetGroup(groupName))
.BuildNotification();
var data = new AppNotificationProgressData (sequenceNumber /* Sequence number */);
data.Title = "Retreiving files"; // Binds to {progressTitle} in xml payload
data.Value = (double) currentFile / totalFiles; // Binds to {progressValue} in xml payload
data.ValueStringOverride = String.Format("{0}/{1} files", currentFile, totalFiles); // Binds to {progressValueString} in xml payload
data.Status = "Downloading..."; // Binds to {progressStatus} in xml payload
notification.Progress = data;
AppNotificationManager.Default.Show(notification);
Die resultierende XML-Nutzlast:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Downloading your weekly playlist...</text>
<progress title='{progressTitle}' status='{progressStatus}' value='{progressValue}' valueStringOverride='{progressValueString}'/>
</binding>
</visual>
</toast>
Aktualisieren Sie die gebundenen Werte durch Aufrufen von AppNotificationManager.UpdateAsync) und angeben Sie das Tag und optional die Gruppe des Tags, das Sie aktualisieren möchten.
private async Task UpdateProgressBar()
{
var data = new AppNotificationProgressData(sequenceNumber /* Sequence number */);
data.Title = "Retreiving files"; // Binds to {progressTitle} in xml payload
data.Value = (double)currentFile / totalFiles; // Binds to {progressValue} in xml payload
data.ValueStringOverride = String.Format("{0}/{1} files", currentFile, totalFiles); // Binds to {progressValueString} in xml payload
data.Status = (currentFile < totalFiles) ? "Downloading..." : "Complete!"; // Binds to {progressStatus} in xml payload
await AppNotificationManager.Default.UpdateAsync(data, tagName, groupName);
}
Hinweise
Aktualisieren Sie den gebundenen Titelwert, indem Sie der Eigenschaft AppNotification.Progressein AppNotificationProgressData-Objekt zuweisen.
Sie können den Titel auch mit der AppNotificationProgressBar.Title-Eigenschaft oder durch Aufrufen von AppNotificationProgressBar.SetStatus festlegen.
Anleitungen zur Verwendung der AppNotificationBuilder--APIs zum Erstellen der Benutzeroberfläche für App-Benachrichtigungen finden Sie unter App-Benachrichtigungsinhalt.
Referenzinformationen zum XML-Schema für App-Benachrichtigungen finden Sie unter App-Benachrichtigungsinhaltsschema.