【发布时间】:2015-01-26 10:00:18
【问题描述】:
怎么可能只有 WindowsFormsHost 中的 第一个 UserControl 显示在 GUI 中,而第二个仍然隐藏?
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf_zoom0="clr-namespace:LowLightGrab;assembly=LowLightGrab"
xmlns:wf_zoom1="clr-namespace:LowLightGrab;assembly=LowLightGrab"
Title="MainWindow" Height="350" Width="525">
<Grid>
<WindowsFormsHost Height="154" HorizontalAlignment="Left" Name="wf_zoom0" VerticalAlignment="Top" Width="215" >
<wf_zoom0:UserControl1/>
</WindowsFormsHost>
<WindowsFormsHost Height="161" HorizontalAlignment="Left" Margin="251,138,0,0" Name="wf_zoom1" VerticalAlignment="Top" Width="223" >
<wf_zoom1:UserControl1/>
</WindowsFormsHost>
</Grid>
【问题讨论】:
-
删除您的保证金 Margin="251,138,0,0"
-
@eranotzap 为什么会有影响?
-
因为两个都显示了,只是你把第二个推到右边251像素,所以你看不到。
标签: c# wpf xaml user-controls