删除"X"TextBox末尾的按钮 [英] Remove "X" button at the end of a TextBox

查看:57
本文介绍了删除"X"TextBox末尾的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#+ XAML开发Windows应用商店.当我添加一个属性为 TextWrapping 的TextBox设置为 NoWrap 时,当焦点对准时,在文本框的末尾会出现一个"X".

因此,我需要删除此"X",并且TextBox无法换行.

解决方案

从本文档中您可以看到,它很好地解释了该功能:

但是,如上所述,它是一个非常漂亮且有用的工具.特别是在触摸屏设备上;它不仅符合Microsoft的统一标准,而且还使UI更加整洁,因为您可以使用一种简单的方法来删除该字段中的项目.

我敦促您不要删除它,希望这对您有所帮助.

I'm developing a Windows Store App using C# + XAML. When I add a TextBox with the property TextWrapping set to NoWrap, a "X" appears at the end of the TextBox when it's focused.

So, I need to remove this "X" and the TextBox can not Wrap.

解决方案

As you can see from this documentation it explains the feature quite well. As you can see when utilizing Javascript, Html, or Css you have very quick concise ways to remove that field. As you can simply disable it with Cascading Stylesheets.

Now within a Stylesheet you can actually alter it quite easy:

input[type=text]::-ms-clear
{
            border: 2px solid orange
}

Most of the buttons are really easy to utilize for a consistent design within your application. But that doesn't answer your question, how do you disable it with C#/XAML?

Inside of the Textbox Component you'll notice code that indicates Visual State and Visibility. If you comment out that section of code it will disable the X. An example here:

As mentioned above though, it is a very nifty and useful tool. Especially on touch screen devices; not only does it adhere to Microsofts unification but it also makes the UI cleaner as you have a simple way to delete the items in that field.

I'd urge you not to remove it, hopefully this explains the issue a little bit for you.

这篇关于删除"X"TextBox末尾的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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