SearchPane.PlaceholderText 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
用户未输入任何字符时搜索框中的占位符文本。
public:
property Platform::String ^ PlaceholderText { Platform::String ^ get(); void set(Platform::String ^ value); };
/// [get: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.ApplicationModel.Search.SearchContract)]
/// [set: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.ApplicationModel.Search.SearchContract)]
winrt::hstring PlaceholderText();
void PlaceholderText(winrt::hstring value);
/// [get: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
/// [set: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
winrt::hstring PlaceholderText();
void PlaceholderText(winrt::hstring value);
public string PlaceholderText { [Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.ApplicationModel.Search.SearchContract))] get; [Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.ApplicationModel.Search.SearchContract))] set; }
public string PlaceholderText { [Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")] get; [Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")] set; }
var string = searchPane.placeholderText;
searchPane.placeholderText = string;
Public Property PlaceholderText As String
属性值
要显示在搜索框中的占位符文本。
- 属性
注解
重要
若要在应用中实现Windows 10或更高版本的搜索,请使用 AutoSuggestBox。 有关详细信息 ,请参阅自动建议框 。
不应在适用于 Windows 10 或更高版本的应用中使用 Windows.ApplicationModel.Search API (SearchPane、 SearchContract
) 或 SearchBox API。
注意
应用不能同时使用搜索框 (Windows.UI.Xaml.Controls.SearchBox/WinJS.UI.SearchBox) 和 SearchPane。 在同一应用中同时使用搜索框和搜索窗格会导致应用引发异常,并显示以下消息:“无法创建类型为'Windows.UI.Xaml.Controls.SearchBox'的实例。
可以使用占位符文本向用户指示他或她可以搜索的内容。
如果占位符文本太长,无法容纳在搜索框中,系统会截断文本,而不会引发异常。