为什么我的 WPF 文本框不显示任何字符?
我有一个应用程序,其中包含一个用 WPF 编写的 DLL。该应用程序以登录窗口启动(该应用程序是 Windows 窗体,DLL 位于 WPF 中)。当我键入用户名或密码时,我看不到文本框中的字符,但它们按预期保存在文本框或密码框的 Text
1 属性中。
什么可以解释这种行为,以及如何修复它以便在键入字符时看到它们?
I have an application which includes a DLL written in WPF. This application starts with the login window (the application is a Windows Form and the DLL is in WPF). When I type the user name or password I can't see the characters in the textbox, but they are saved in the Text
1 property of both the textBox or the passwordBox as expected.
What could explain this behavior, and how can I fix it so that I see the characters as they're typed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许前景色等于背景色?如果您尝试在输入后选择文本,您会得到一些东西吗?
Maybe could it be the foreground color which is equal to the background color ? If you try selecting text after typing, do you get something ?
前景和背景不一样,我查了一下……
我收到了我输入的文本,但我看不到它,这是我见过的最奇怪的事情......我已经打开了另一个项目
the foreground and the background are not the same, i have checked it...
i get the text i type in but i can't see it, this is the most weird thing i have ever seen....i have opened another project
我在您的场景中看到了这一点:当 WPF 窗口由 Windows 窗体应用程序托管时。
您需要在单独的线程中运行 WPF 窗口以避免此问题。
I have seen this in your scenario: when the WPF window is hosted from a Windows Form application.
You need to run the WPF window in a separate thread to avoid this problem.