[UWP]在UWP中制作文本框的大写字母 [英] [UWP]To Make Capital letters of textbox in UWP

查看:71
本文介绍了[UWP]在UWP中制作文本框的大写字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用ToUpper在UWP中的TextBox中创建大写字母,但是在其他任何解决方案中都会出现Cursor位置问题? 

解决方案

< blockquote>

我创建了一个新的UWP应用程序来测试它,它似乎工作。在XAML中的文本框上双击它以创建私有void yourtextboxname_TextChanged。我的情况是testtext。现在无论我输入什么,它总是大写的。这是你要找的


 private void testtext_TextChanged(object sender,TextChangedEventArgs e)
{

testtext.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToUpper(testtext.Text);
}


此外,您还需要添加一些程序集引用,但只需右键单击带红色下划线的代码并单击可能的修复程序,它应该为您添加它。




I have used ToUpper to make capital letters in TextBox in UWP but getting issue of Cursor position in that Any other solution for it ? 

解决方案

I created a new UWP application to test this and it seemed to work. On your textbox in XAML double click on it to create the private void yourtextboxname_TextChanged. My case it was testtext. Now whatever I type in it will always be capitalized. This what you are looking for?

    private void testtext_TextChanged(object sender, TextChangedEventArgs e)
        {
         
                testtext.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToUpper(testtext.Text);
        }

Also you will need to add some assembly references but just right click on the red underlined code and click potential fixes and it should add it in for you.



这篇关于[UWP]在UWP中制作文本框的大写字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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