0

So I have an odd issue while trying to use a WPF TextBox with SpellCheck enabled inside a Winforms form, using the custom control defined in this post.
This works just fine, I've tried using it in my own sandbox project and it looks great. The problem is when I try to replace the Winforms TextBoxes inside one of our existing forms. The SpellCheck context menu is "trapped" inside the control, so all I can see are the up/down arrows of the menu.
enter image description here
I'm not too familiar with Winforms, as I mostly work with WPF, so I'm having a hard time determining the problem. The text box shown above is the custom control as mentioned in the linked post. The control is contained in a forms TableLayoutPanel. How can I get the context menu to expand and actually be visible?

Edit
First, to clarify, the context menu appears normally when displayed in a console application that opens the form. I did a little more testing and created a new web project (what the original problem project is) with a button that opens the form, and then the problem behavior occurs. What difference between the console application and the web application would cause this?

Edit 2
I tried the suggestions in this post, thinking maybe the context menu really was just being automatically sized incorrectly (to fit the parent control). But none of those solutions seemed to make any difference either.

Edit 3
After using snoop to look at the differences between the working context menu (windows application) and the not-working one (xbap) the only difference I could see was that the DesiredSize of the xbap instance's context menu has a smaller size, I just have no idea why.

Community
  • 1
  • 1
Valenthorpe
  • 73
  • 10

1 Answers1

-1

The wpf control is a control which is hosted in winforms via the ElementHost.

Hence it lives within the area provided by the parent.

The only way is to expand it, is to change the size of the parent. Give it a try by creating a winform supersized textbox as a quick debug example. Note whether the size change works on not. If it does can the GUI accommodate that change? I can't answer that.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
  • 1
    This is what I had originally thought was the problem at first. The weird thing is that, after some more testing, this behavior does not occur if I just run a console application that opens the form. The context menu will open as normal. However, once I created a new xbap project and opened the form from that, is when the context menu becomes limited by the control. – Valenthorpe May 07 '15 at 14:57