开发者

WPF Control inside ElementHost is invisible

I have a WPF control (the ICSharpCode.AvalonEdit.TextEditor) in a Winforms project inside an ElementHost.

I have confirmed with the debugger that the TextEditor is actually set as the child of the ElementHost, and all its properties are being set correctly, it's just invisible and unable to be interacted with (as if you had set the IsVisible property to false).

The ElementHost shows up, and I can interact with tha开发者_开发百科t, but it's rather that the Child control is not visible. I've checked that the TextEditor's Visiblity and IsVisible properties are as they should be.

I have never actually written a WPF app, so try any suggestions no matter how simple that could mean that my WPF control is invisible. It could be to do with the ElementHost, the control itself, or to do with specific AvalonEdit behaviour.

Any suggestions?


It turns out that I was setting that margin property of the TextEditor to a number far too high like this:

TextEditor.Margin = 1000;

And this margin was covering the entire control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜