简体   繁体   English

为什么我的WPF TextBox不显示任何字符?

[英]Why does my WPF TextBox not show any characters?

I have an application which includes a DLL written in WPF. 我有一个应用程序,其中包含一个用WPF编写的DLL。 This application starts with the login window (the application is a Windows Form and the DLL is in WPF). 此应用程序从登录窗口开始(应用程序是Windows窗体,DLL在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. 当我输入用户名或密码时,我无法看到文本框中的字符,但它们会按预期保存在textBox或passwordBox的Text 1属性中。

What could explain this behavior, and how can I fix it so that I see the characters as they're typed? 有什么可以解释这种行为,我该如何解决这个问题,以便在输入字符时看到字符?

I have seen this in your scenario: when the WPF window is hosted from a Windows Form application. 我在您的场景中看到了这一点:WPF窗口是从Windows窗体应用程序托管的。

You need to run the WPF window in a separate thread to avoid this problem. 您需要在单独的线程中运行WPF窗口以避免此问题。

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 ? 如果你在打字后尝试选择文字,你会得到什么吗?

前景和背景是不一样的,我已经检查了...我得到了我输入的文字,但我看不到它,这是我见过的最奇怪的事情....我已经开了另一个项目

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

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