AppTaskContent.SetTextInput(String, String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为用户设置文本输入字段以提供自由格式的文本响应。
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
一个 URI 模板字符串,其中包含 {userTextInput} 在提交时将替换为用户的转义输入文本。
- 属性
注解
重要
从 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。