WPF无模式对话框使文本框不可编辑 [英] WPF modeless dialog renders textbox uneditable

查看:1572
本文介绍了WPF无模式对话框使文本框不可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个WPF形式,我启动从一个WinForms窗口,所有的文本框为不可编辑的显示出来时,它的推出是一个无模式对话框。它的工作原理以及当它是一个模态窗口。我仍然能够键入空格或粘贴文本。但经常打字不工作。我使用的是3.5 SP1的。请问有人知道如何解决呢?

A WPF form that I launch from a WinForms window shows up with all textboxes as uneditable when it's launched as a modeless dialog. It works well when it's a modal window. I'm still able to type spaces or paste text. But regular typing doesn't work. I'm using 3.5 with SP1. Would anybody know how to resolve this?

推荐答案

您需要确保调用<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.enablemodelesskeyboardinterop.aspx">ElementHost.EnableModelessKeyboardInterop为您的WPF窗口。此挂钩了WPF消息循环,使键盘输入。

You need to make sure to call ElementHost.EnableModelessKeyboardInterop for your WPF Window. This hooks up the WPF message loop to allow keyboard input.

这篇关于WPF无模式对话框使文本框不可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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