다음을 통해 공유


AppNotificationBuilder.SetGroup(String) 메서드

정의

앱 알림에 대한 그룹 식별자를 설정합니다.

public:
 virtual AppNotificationBuilder ^ SetGroup(Platform::String ^ group) = SetGroup;
AppNotificationBuilder SetGroup(winrt::hstring const& group);
public AppNotificationBuilder SetGroup(string group);
function setGroup(group)
Public Function SetGroup (group As String) As AppNotificationBuilder

매개 변수

group
String

Platform::String

winrt::hstring

앱 알림이 속한 그룹을 식별하는 문자열입니다.

반환

추가 메서드 호출을 연결할 수 있도록 AppNotificationBuilder instance 반환합니다.

예제

다음 예제에서는 앱 알림에 대한 그룹을 설정하는 방법을 보여 줍니다.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .SetGroup("Notification group")
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

결과 XML 페이로드:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
</toast>

그룹별로 알림 센터에서 모든 알림을 제거하는 예제입니다.

await AppNotificationManager.Default.RemoveByGroupAsync("Notification group");

설명

그룹 식별자를 사용하여 AppNotificationManager.RemoveByGroupAsync를 호출하여 알림 센터에서 그룹의 모든 앱 알림을 제거할 수 있습니다.

AppNotificationBuilder API를 사용하여 앱 알림에 대한 UI를 만드는 방법에 대한 지침은 앱 알림 콘텐츠를 참조하세요.

앱 알림에 대한 XML 스키마에 대한 참조 정보는 앱 알림 콘텐츠 스키마를 참조하세요.

적용 대상