我想在一个WPF用户控件来包装一个Windows窗体控件WPF WindowsFormsHost浆纱
<UserControl x:Class="MVVMLibrary.ReportViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ws="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
Height="Auto" Width="Auto">
<Grid>
<WindowsFormsHost Name="Host">
<ws:ReportViewer/>
</WindowsFormsHost>
</Grid>
</UserControl>
注意高度和宽度自动。
当我在一个堆栈面板或网格控件中它将其高度设置为0并基本消失。然后用户需要调整窗口大小(因为用户控件说我不需要空间,所以缩小了窗口大小,谢谢)。当用户调整大小时,它会延伸到用户指定的任何地方。
所以我的问题是我做错了什么?我如何让我的用户控件获得所有可用空间而不是不要求任何?
谢谢 - 不知怎的,给予控制背景颜色大大减少控件的闪烁。 – Justin 2012-05-29 15:59:39