Windows Store 应用 - 如何在搜索 Charm 文本框中添加水印

4

我已在我的Windows 8应用程序中实现了搜索合同。

然而,当用户从应用程序内部调出搜索窗口时,搜索框最初是空白的。 我注意到其他应用程序在框内有默认的“水印”,例如必应地图应用程序:

enter image description here

我该如何重现此行为并添加自己的水印?

1个回答

3

好的,这并没有在主要入门指南页面搜索指南中记录,但您可以按照以下方式进行:

    protected override async void OnWindowCreated(WindowCreatedEventArgs args)
    {
        SearchPane sp = SearchPane.GetForCurrentView();
        sp.PlaceholderText = "Enter the name of a town or city";
    }

我建议将它放置在App.xaml.cs文件中的OnWindowCreated(...)方法中。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接