><Page x:Class="WPFHost.Page1" > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > Title="Page1"> > <Grid> > <StackPanel Margin="0,0,0,0" Name="stackPanel" > HorizontalAlignment="Left" VerticalAlignment="Top" /> > </Grid> ></Page> > > > > >page1.xaml.cs: > > >using System.Windows.Controls; >using System.Windows.Forms.Integration; >using MyApp.UI; > >namespace WPFHost >{ > /// <summary> > /// Interaction logic for Page1.xaml > /// </summary> > public partial class Page1 : Page > { > private readonly MainForm mainForm = new MainForm(); > > public Page1() > { > InitializeComponent(); > > //Create a Windows Forms Host to host a form > WindowsFormsHost windowsFormsHost = new WindowsFormsHost(); > > stackPanel.Width = mainForm.Width; > stackPanel.Height = mainForm.Height; > windowsFormsHost.Width = mainForm.Width; > windowsFormsHost.Height = mainForm.Height; > > mainForm.TopLevel = false; > > windowsFormsHost.Child = mainForm; > > stackPanel.Children.Add(windowsFormsHost); > } > } >} >Hi,