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

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

问题描述

当我从 WinForms 窗口启动的 WPF 表单作为无模式对话框启动时,所有文本框都显示为不可编辑.当它是模态窗口时效果很好.我仍然可以输入空格或粘贴文本.但是常规输入不起作用.我正在使用带有 SP1 的 3.5.有人知道如何解决这个问题吗?

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?

推荐答案

你需要确保调用 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天全站免登陆