2015-01-26 2 views
1

UserControl과 WindowsFormsHost는 GUI에 표시되는 반면, 그 중 두 번째는 여전히 숨겨져 있습니다. 에 란은, 당신은 lile이 뭔가를 그리드에 행을 추가하고 자신의 행의 각 요소를 배치해야합니다 추가로 마진을 제거하는 이외에첫 번째로 참조 된 UserControl 만 보임

<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> 

+0

제거하여 margin 여백 = "251,138,0,0" –

+0

@eranotzap 왜 이것이 영향을 주어야합니까? – Norick

+0

둘 다 표시되었으므로 두 번째 것은 오른쪽으로 251 픽셀 씩 밀어 넣었으므로 보이지 않습니다. –

답변

0

:

<Window x:Class="ComboboxRectangles.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="MainWindow" Height="350" Width="525"> 
<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> 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition></ColumnDefinition> 
      <ColumnDefinition></ColumnDefinition> 
     </Grid.RowDefinitions> 
     <WindowsFormsHost Grid.Column="0" Height="154" HorizontalAlignment="Left" Name="wf_zoom0" VerticalAlignment="Top" Width="215" > 
      <wf_zoom0:UserControl1/> 
     </WindowsFormsHost> 

     <WindowsFormsHost Grid.Column="1" Height="161" HorizontalAlignment="Left" Margin="251,138,0,0" Name="wf_zoom1" VerticalAlignment="Top" Width="223" > 
      <wf_zoom1:UserControl1/> 
     </WindowsFormsHost> 
    </Grid> 
</Window> 
+0

결과는 여전히 동일하지만 여백이 있거나없는 첫 번째 선언 된 UserControl 만 표시됩니다. 그것은 아마도 UserControl 자체에 의존합니까? 카메라에서 읽은 이미지입니다. – Norick

+0

버튼을 대신 넣으시겠습니까? –

+0

버튼을 배치 할 위치는 어디입니까? 각 열에 하나의 버튼을 배치 할 수 있으며 둘 다 표시되지만 첫 번째 WindowsFormsHost 만 표시됩니다. – Norick

관련 문제