다음을 통해 공유


AppNotificationButton.AddArgument(String, String) 메서드

정의

앱 알림 단추에 대한 XML 페이로드에 키/값 쌍으로 구성된 인수를 추가합니다.

public:
 virtual AppNotificationButton ^ AddArgument(Platform::String ^ key, Platform::String ^ value) = AddArgument;
AppNotificationButton AddArgument(winrt::hstring const& key, winrt::hstring const& value);
public AppNotificationButton AddArgument(string key, string value);
function addArgument(key, value)
Public Function AddArgument (key As String, value As String) As AppNotificationButton

매개 변수

key
String

Platform::String

winrt::hstring

인수의 키를 포함하는 문자열입니다.

value
String

Platform::String

winrt::hstring

인수의 값을 포함하는 문자열입니다.

반환

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

예제

다음 예제에서는 이 메서드를 사용하여 앱 알림 단추에 인수를 추가하는 방법을 보여 줍니다.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .AddButton(new AppNotificationButton("Reply")
        .AddArgument("action", "reply"))
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

결과 XML 페이로드:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <actions>
        <action content='Reply' arguments='action=reply'/>
    </actions>
</toast>

설명

이 메서드를 사용하여 추가된 앱 알림 단추 인수는 사용자가 단추를 클릭하면 활성화된 애플리케이션에 전달됩니다. 각 단추에 여러 인수를 추가할 수 있습니다. AppNotificationActivatedEventArgs.Arguments 속성에 액세스하여 이 메서드를 사용하여 추가된 인수를 검색하거나 한 호출에서 여러 인수를 추가할 수 있습니다.

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

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

적용 대상