AppNotificationProgressBar.BindStatus Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Binds the AppNotificationProgressBar.Status property.
public:
virtual AppNotificationProgressBar ^ BindStatus() = BindStatus;
AppNotificationProgressBar BindStatus();
public AppNotificationProgressBar BindStatus();
function bindStatus()
Public Function BindStatus () As AppNotificationProgressBar
Returns
Returns the AppNotificationProgressBar instance so that additional method calls can be chained.
Examples
The following example illustrates how to set the Status property of an app notification progress bar using data binding.
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);
The resulting XML payload:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Downloading your weekly playlist...</text>
<progress title='{progressTitle}' status='{progressStatus}' value='{progressValue}' valueStringOverride='{progressValueString}'/>
</binding>
</visual>
</toast>
Update the bound values by calling AppNotificationManager.UpdateAsync) and specifying the tag, and optionally the group, of the tag you want to update.
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);
}
Remarks
The Status value is bound by default. Update the bound status value by assigning an AppNotificationProgressData object to the AppNotification.Progresss property.
You can also set the status with the AppNotificationProgressBar.Status property or by calling AppNotificationProgressBar.SetStatus).
For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.
For reference information about the XML schema for app notifications, see App notification content schema.