AppTaskContent.AddButton(String, Uri) Method

Definition

Adds a button to the task content that the user can click to take an action.

public:
 virtual void AddButton(Platform::String ^ text, Uri ^ actionUri) = AddButton;
/// [Windows.Foundation.Metadata.Experimental]
void AddButton(winrt::hstring const& text, Uri const& actionUri);
[Windows.Foundation.Metadata.Experimental]
public void AddButton(string text, System.Uri actionUri);
function addButton(text, actionUri)
Public Sub AddButton (text As String, actionUri As Uri)

Parameters

text
String

Platform::String

winrt::hstring

The text to display on the button.

actionUri
Uri Uri

The URI that is launched when the user clicks the button.

Attributes

Remarks

Important

App task support will start gradually rolling out to Windows 11 starting May, 2026. The experiences enabled by Windows.UI.Shell.Tasks APIs require that the corresponding app task feature be present in the version of Windows where the app runs. Otherwise, these APIs will not have any effect.

Use buttons when the task needs user attention and you want to provide simple action choices. The maximum number of buttons you can add is defined by MaxButtons. Typically used in combination with SetQuestion when the task state is NeedsAttention.

Applies to