在文本框中包含一个按钮 [英] Include a Button in a TextBox

查看:151
本文介绍了在文本框中包含一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个按钮,该按钮会删除文本框中的所有文本.是否可以将删除"按钮放到文本框中(例如在 iPhone文本框中)?

I want to add a little Button, which removes all the text in the TextBox. Is it possible to put this "Remove"-Button into the TextBox (like in the iPhone Textboxs)?

我希望在您的帮助下,它看起来像这样:

I hope after your help it looks like that:

我用controltemplate播放了一些内容,但没有得到想要的结果.

I played something with the controltemplate but didn't get the wished result.

解决此问题的一种方法可能是使用按钮的负边距,但我认为这不是一个干净的解决方案.

One way to solve this problem could be to use negative margins of the button, but i think that isn't a clean solution.

谢谢!

推荐答案

您可以轻松地从文本框派生并使用所需的功能创建自己的文本框.这就是wpf提供的灵活性.请参见下面的链接

You can easily derive from textbox and create your own textbox with the functionality you want.That is the flexibility that wpf provides.See the link below

http://davidowens.wordpress.com/2009/02/18/wpf-search-text-box/

这篇关于在文本框中包含一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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