AppNotificationButton.IsButtonStyleSupported 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回值,指出目前裝置上的代理程式更新按鈕是否支援按鈕樣式。
public:
static bool IsButtonStyleSupported();
static bool IsButtonStyleSupported();
public static bool IsButtonStyleSupported();
function isButtonStyleSupported()
Public Shared Function IsButtonStyleSupported () As Boolean
傳回
Boolean
bool
如果支援按鈕樣式,則為 True;否則為 false。
範例
下列範例示範如何檢查是否支援代理程式更新按鈕樣式,如果是,請設定按鈕樣式。
var button = new AppNotificationButton("Reply")
.AddArgument("action", "reply");
if(AppNotificationButton.IsButtonStyleSupported())
{
button.SetButtonStyle(AppNotificationButtonStyle.Critical);
}
var builder = new AppNotificationBuilder()
.AddText("Notification text.")
.AddButton(button);
AppNotificationManager.Default.Show(builder.BuildNotification());
如果支援緊急案例,則產生的 XML 承載:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
<actions>
<action content='Reply' arguments='action=reply' hint-toolTip='Click to reply.'/>
</actions>
</toast>
備註
AppNotificationButton.SetButtonStyle方法可讓您從AppNotificationButtonStyle列舉中指定其中一個按鈕樣式,以提供一致的常見案例體驗。 只有 Windows 10 組建 19041 和更新版本才支援此功能。 這個方法可讓您在執行時間判斷目前裝置是否支援按鈕樣式。
如需使用 AppNotificationBuilder API 建立代理程式更新 UI 的指引,請參閱 代理程式更新內容。
如需代理程式更新之 XML 架構的參考資訊,請參閱 代理程式更新內容架構。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應