简体   繁体   English

WPF应用程序上的MaxLength不适用于朝鲜语

[英]MaxLength on WPF app does not work for Korean Language

I'm having trouble trying to get the MaxLength property of a TextBox in WPF to work when I'm using a on screen keyboard with Korean language. 当我使用韩语屏幕键盘时,尝试在WPF中获取TextBox的MaxLength属性时遇到问题。

It just doesn't limit and also it won't give me any event other than TextChanged, so I didn't find a way to avoid the character being written on the screen. 它只是没有限制,而且除了TextChanged之外也不会给我任何其他事件,因此我没有找到避免该字符写在屏幕上的方法。

Also, if i try to just remove the character just after being inserted and change the caret position to the end, the app just crashes without any exception during debugging. 另外,如果我尝试在插入字符后立即删除字符,并将插入符号的位置更改为末尾,则该应用程序将在调试期间崩溃而无任何异常。

I would really appreciate if you have any ideas on how could I fix it! 如果您对如何解决它有任何想法,我将不胜感激!

Thanks!! 谢谢!!

1st, 1号

textbox.PreviewTextInput += textbox_PreviewTextInput;

void textbox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
   TextBox box = (TextBox) sender;
   e.Handled = box.Text.Length > 5;
}

2nd, post a bug to MS Connect 2,将错误发布到MS Connect

3rd, enable all exceptions Debug-Exceptions, then maybe not JustMyCode in options to see what happens. 第三,启用所有异常Debug-Exceptions,然后在选项中启用JustMyCode,以查看会发生什么。

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

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