I am using a WindowsFormsHost to display 640x480 images. The WindowsFormsHost works fine using Height="120" Width="160" and Grid.ColumnSpan="3" like this
<Grid Name="MainGrid" Margin="10 10 10 10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<WindowsFormsHost Name="WindowsFormsHostL" Height="120" Width="160"
HorizontalAlignment="Center" Grid.Row="0" Grid.Column="0"
Grid.ColumnSpan="3"/>
But when I try to double the size of the WindowsFormsHost like this
<WindowsFormsHost Name="WindowsFormsHostL" Height="240" Width="320"
HorizontalAlignment="Center" Grid.Row="0" Grid.Column="0"
Grid.ColumnSpan="3"/>
the WindowsFormsHost is correct in the .NET xaml viewer but appears to get smaller, do a HorizontalAlignment="Left", and go square. This
Debug.WriteLine(
"WindowsFormsHostL.ActualHeight " + WindowsFormsHostL.ActualHeight
+ " WindowsFormsHostL.ActualWidth " + WindowsFormsHostL.ActualWidth);
prints this
WindowsFormsHostL.ActualHeight 240 WindowsFormsHostL.ActualWidth 320
at so the runtime seems to think it is correct. I am doing clean builds. What am I miss-understanding? Why can't I simply increase the size of this WindowsFormsHost in the xaml?
WindowsFormsHostto be a certain size, then it will generally be that size. Are you sure that the images are not being rendered too small in theWinFormscontrol instead? - SheridanWinFormsimage control that you are loading the images into has its size dimension set. - Sheridan