Language

BadgeNotificationManager クラス

定義

アプリのタスク バー アイコンに表示されるバッジ通知を管理するメソッドを提供します。

public ref class BadgeNotificationManager sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.BadgeNotifications.BadgeNotificationsContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class BadgeNotificationManager final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.BadgeNotifications.BadgeNotificationsContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class BadgeNotificationManager
Public NotInheritable Class BadgeNotificationManager
継承
Object Platform::Object IInspectable BadgeNotificationManager
属性

例

この例では、 SetBadgeAsGlyph を呼び出して、 Alert グリフで通知バッジを設定する方法を示します。

BadgeNotificationManager.Current.SetBadgeAsGlyph(BadgeNotificationGlyph.Alert);

この例では、 SetBadgeAsCount を呼び出して、数値が 20 の通知バッジを設定する方法を示します。

BadgeNotificationManager.Current.SetBadgeAsCount(20);

この例では、タスク バー アイコンのバッジをアプリの InfoBadge コントロールと同期する方法を示します。 コードの NavigationView での数値 InfoBadge のインクリメントの例を参照してください。 このコードは、そのサンプルの MainWindow コンストラクターに追加されます。 DependencyObject.RegisterPropertyChangedCallback メソッドを使用して、InfoBadge.Value プロパティへの変更をリッスンします。

public MainWindow()
{
    this.InitializeComponent();

    mailCountBadge.RegisterPropertyChangedCallback(InfoBadge.ValueProperty, (s, e) =>
    {
        if (e == InfoBadge.ValueProperty)
        {
            BadgeNotificationManager.Current.SetBadgeAsCount((uint)mailCountBadge.Value);
        }
    });
}

注釈

通知バッジは、アプリに固有の概要または状態情報を伝えます。 システム提供のグリフまたは数値 (1 から 99) のセットのいずれかです。 数値バッジが 99 より大きい値に設定されている場合は、"99+" と表示されます。

通知バッジがアプリのタスク バー アイコンに表示されます。 アプリがタスク バーにピン留めされている場合、アプリが実行されていない場合でもバッジが表示されます。

プロパティ

名前 説明
Current

現在のアプリの BadgeNotificationManager のインスタンスを取得します。

メソッド

名前 説明
ClearBadge()

アプリのタスク バー アイコンからバッジを削除します。

SetBadgeAsCount(UInt32)

指定した整数値をアプリのタスク バー アイコンのバッジとして適用します。

SetBadgeAsGlyph(BadgeNotificationGlyph)

指定したグリフ値をアプリのタスク バー アイコンのバッジとして適用します。

適用対象