語言

AppTaskContent.SetTextInput(String, String) 方法

定義

建立文字輸入欄位,讓使用者能提供自由形式的文字回應。

public:
 virtual void SetTextInput(Platform::String ^ placeholderText, Platform::String ^ actionUriTemplate) = SetTextInput;
/// [Windows.Foundation.Metadata.Experimental]
void SetTextInput(winrt::hstring const& placeholderText, winrt::hstring const& actionUriTemplate);
[Windows.Foundation.Metadata.Experimental]
public void SetTextInput(string placeholderText, string actionUriTemplate);
function setTextInput(placeholderText, actionUriTemplate)
Public Sub SetTextInput (placeholderText As String, actionUriTemplate As String)

參數

placeholderText
String

Platform::String

winrt::hstring

佔位文字顯示在輸入欄位中,用以引導使用者。

actionUriTemplate
String

Platform::String

winrt::hstring

包含 {userTextInput} 該 的 URI 範本字串,提交時會被使用者的逃逸輸入文字取代。

屬性

備註

這很重要

應用程式任務支援將從 2026 年 5 月開始逐步推送至 Windows 11。 API Windows.UI.Shell.Tasks 所啟用的體驗要求對應的應用程式任務功能必須存在於該應用程式執行的 Windows 版本中。 否則,這些 API 將不會有任何影響。

當任務需要注意時,使用此方法收集使用者的文字輸入。 {userTextInput} URI 範本中的表達式被 URL 編碼的使用者輸入取代。 例如,若模板為 , my-app:task/?response={userTextInput} 使用者輸入「僅作用域」,則產生的 URI 將為 my-app:task/?response=scope%20only。

適用於