简体   繁体   English

如何在wp7的文本框中隐藏特定文本

[英]How to hide a particular text in a textbox for wp7

In my web browser app for wp7, i have a textbox for the URL's(named as UrlTextBox), in that i don't need the http:// to be visible even when the page is navigating or navigated. 在适用于wp7的Web浏览器应用程序中,我有一个URL文本框(名为UrlTextBox),因为即使在页面导航或导航时,我也不需要http://即可看到。 I don't know how to hide a particular text in a textbox. 我不知道如何在文本框中隐藏特定的文本。 If i try to omit the http:// permanently then there will an error in my app. 如果我尝试永久省略http://,则我的应用程序中将出现错误。 Can anybody help me with this? 有人可以帮我吗? Thanks in advance for your help! 在此先感谢您的帮助!

I'd guess you're probably doing something like: 我猜你可能正在做类似的事情:

webBrowser.Navigate(urlTextBox.Text);

Instead you could just do: 相反,您可以执行以下操作:

webBrowser.Navigate("http://" + urlTextBox.Text);

Obviously with appropriate checks, etc. 显然要进行适当的检查,等等。

OR 要么

if (urlTextBox.Text.StartsWith("http://")
{
    urlTextBox.Text = urlTextBox.Text.SubString(7);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM