AppNotificationProgressBar.SetStatus(String) 方法

定义

设置应用通知进度栏的状态文本。

public:
 virtual AppNotificationProgressBar ^ SetStatus(Platform::String ^ value) = SetStatus;
AppNotificationProgressBar SetStatus(winrt::hstring const& value);
public AppNotificationProgressBar SetStatus(string value);
function setStatus(value)
Public Function SetStatus (value As String) As AppNotificationProgressBar

参数

value
String

Platform::String

winrt::hstring

包含状态值的字符串。

返回

返回 AppNotificationProgressBar 实例,以便可以链接其他方法调用。

示例

以下示例演示如何设置应用通知进度栏的 Status 属性。

 var notification = new AppNotificationBuilder()
    .AddText("Downloading your weekly playlist...")
    .AddProgressBar(new AppNotificationProgressBar()
        .SetTitle("Progress bar title")
        .SetValue(.5)
        .SetStatus("Downloading...")
        .SetValueStringOverride("1/2 files downloaded"))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

生成的 XML 有效负载:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Downloading your weekly playlist...</text>
            <progress title='Progress bar title' status='Downloading...' value='0.5' valueStringOverride='1/2 files downloaded'/>
        </binding>
    </visual>
</toast>

注解

还可以使用 AppNotificationProgressBar.Status 属性设置状态。

默认情况下,“状态”值是绑定的。 通过将 AppNotificationProgressData 对象分配给 AppNotification.Progress属性来更新绑定状态值。

有关使用 AppNotificationBuilder API 创建应用通知 UI 的指导,请参阅 应用通知内容

有关应用通知的 XML 架构的参考信息,请参阅 应用通知内容架构

适用于