Hi,
I have a WinForm application which contains a WPF user control. The WPF UserControl is quite complex and requires several seconds to draw.
Currently my code looks like the following:
// Load event of the WinForm App
private void ucMainScreen_Load(object sender, EventArgs e)
{
ganttChartControl = new ucGanttChart(); // WPF Control
wpfElementHost.Child = ganttChartControl;
}
// Loaded Event of the WPF UserControl
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
LoadGanttChart(); // Long process method involving drawing UI elements
}
The problem is, when the app loads for the first time, the window is non responsive until the WPF UserControl has finished loading.
I am looking for a way to keep the app responsive and display a "Loading..." message while the WPF UserControl is loading in the background.
I have been trying to look at the WPF Dispatcher, BackgroundWorker, but I don't really get how it should work...
Is there any way to modify the code above to get the desired behaviour, please?