So I've inherited an application that had ~10 winforms that control program flow. That program now must reside "within" a WPF application using the WindowsFormHost control.
//MainWindow.xaml
<Grid Name="GrdMainGrid">
<WindowsFormsHost Name="FormsHost" Margin="0,100,0,0"></WindowsFormsHost>
</Grid>
I then load the welcome form via codebehind:
//MainWindow.xaml
private void button2_Click(object sender, RoutedEventArgs e)
{
var welcomeForm = new frmWelcome();
welcomeForm.Show();
KioskFormHost.Child = welcomeForm;
}
When I hit this code:
//frmWelcome.cs
button_click() {
frmCategory form1 = new frmCategory();
form1.Show();
form1.Mode = "New";
this.Close();
}
Then I lose the inside form and the other form never displays.
Is there a way to do this?