I have create a HwndSource who will host a WPF TextBox control and set it on topmost, then popup it when user double clicks on the node. Please refer to the following code:
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
But the popup window’s behavior is very strange, it is not always on topmost.
For example:
· Double click a node text, the node begins to edit, then the text box appears:
· But when I move mouse out of the editing node or move mouse entry other node in order to interact with other node, the text box disappear:
· But I can still interact with the text box, it can response to mouse click, select and so on:
· It seems the text box has been covered by tree node. The more strange thing is that even I did not draw the node text when its name is editing, the above cover problem still exists as the figures in the step 2&3.
· Then I set the background with red color, I found it looks like that it is covered by background, I guess perhaps this is caused by some redrawing?
有谁知道究竟是什么原因造成TextBox被遮盖吗?
(PS. 我们程序的主窗口是个MFC的form,而上面的内容都是用DirectX渲染的,不知道这个会不会跟WPF的控件有冲突哦)
目前我们的需求就是能够编辑Text, 并非一定要用HwndSource,是不是直接可以popup一个WPF的popup窗口也能实现这个效果呢?本人对WPF不是很熟悉,忘大虾指教:)