当前位置: 动力学知识库 > 问答 > 编程问答 >

wpf - Putting a windowsformhost inside a usercontrol

问题描述:

I'm trying to put a windowsformshost inside a WPF UserControl. Whenever I shrink the size of the UserControl the windowsformshost seems bleed out of the UserControl? Is there anyway to make the windowsformshost stay inside the usercontrol? I saw some examples online but none of them work. I am putting the windowsformshost inside a grid. Is there someplace else I have to place it? Thank you in advance for the help.

David

网友答案:

If you want your WindowsFormHost always have width and height like your parent control, you can

1) Put it to the DockPanel with LastChildFill="True"

2) Bind to the ActualWidth and ActualHeight of your parent control (either Grid or UserControl) with the width and height of your WindowFormHost.

分享给朋友:
您可能感兴趣的文章:
随机阅读: