占位符文本框 Windows Phone 8 [英] Placeholder Textbox Windows Phone 8

查看:35
本文介绍了占位符文本框 Windows Phone 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过这个 来自 Windows Phone Toolkit 的控件.

它有一个 Hint 属性,它允许你设置一个占位符:

I have read this Adding placeholder text to textbox

The problem is, the placeholder TextBox must be easy to reuse. Either with XAML or Code. Maybe it's something like this

<my:TextBoxPlaceholder Placeholder="this is the placeholder"/>

or

<TextBox Placeholder="this is the placeholder"
         Type="/*staticresources*/PlaceholderTextBox"/>

This is what I'm referring to. (the screen shot I got from Instagram Beta).

As you can see, on the second picture, the "Add a comment" placeholder is on the top most of TextBox, it covers the stripe line. Is the placeholder a picture or a TextBlock on top of it?

解决方案

You can use the PhoneTextBox control from Windows Phone Toolkit.

It has a Hint property which allows you to set a placeholder:

<toolkit:PhoneTextBox Hint="Add a coment" Text={Binding ...} .../>

这篇关于占位符文本框 Windows Phone 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆