Index: Core/Gui/src/Core.Gui/Forms/Main/MainWindow.xaml.cs =================================================================== diff -u -r42312b7efb17be543bfcba213b9c96c3aea0336c -r944d8f057924d6aa559f248328b07bf5d8607a7b --- Core/Gui/src/Core.Gui/Forms/Main/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 42312b7efb17be543bfcba213b9c96c3aea0336c) +++ Core/Gui/src/Core.Gui/Forms/Main/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 944d8f057924d6aa559f248328b07bf5d8607a7b) @@ -46,7 +46,7 @@ using Core.Gui.Selection; using Core.Gui.Settings; using FontFamily = System.Windows.Media.FontFamily; -using FormsControl = System.Windows.Forms.Control; +using UserControl = System.Windows.Forms.UserControl; namespace Core.Gui.Forms.Main { @@ -628,15 +628,15 @@ private void OnViewOpened(object sender, ViewChangeEventArgs e) { var mapView = e.View as IMapView; - if (mapView != null && e.View is FormsControl mapControl) + if (mapView != null && e.View is UserControl mapUserControl) { - mapControl.VisibleChanged += MapViewVisibleChanged; + mapUserControl.VisibleChanged += MapViewVisibleChanged; } var chartView = e.View as IChartView; - if (chartView != null && e.View is FormsControl chartControl) + if (chartView != null && e.View is UserControl chartUserControl) { - chartControl.VisibleChanged += ChartViewVisibleChanged; + chartUserControl.VisibleChanged += ChartViewVisibleChanged; } UpdateComponentsForMapView(mapView); @@ -655,7 +655,7 @@ /// private static void MapViewVisibleChanged(object sender, EventArgs e) { - var control = (FormsControl) sender; + var control = (UserControl) sender; if (control.Width != 0.0 && control.Height != 0.0) { ((IMapView) control).Map.ZoomToVisibleLayers(); @@ -669,7 +669,7 @@ /// private static void ChartViewVisibleChanged(object sender, EventArgs e) { - var control = (FormsControl) sender; + var control = (UserControl) sender; if (control.Width != 0.0 && control.Height != 0.0) { IChartControl chartControl = ((IChartView) control).Chart; Index: Core/Gui/test/Core.Gui.Test/Forms/Main/MainWindowTest.cs =================================================================== diff -u -r965969ab5313efefaacc530d26242f9f1980882b -r944d8f057924d6aa559f248328b07bf5d8607a7b --- Core/Gui/test/Core.Gui.Test/Forms/Main/MainWindowTest.cs (.../MainWindowTest.cs) (revision 965969ab5313efefaacc530d26242f9f1980882b) +++ Core/Gui/test/Core.Gui.Test/Forms/Main/MainWindowTest.cs (.../MainWindowTest.cs) (revision 944d8f057924d6aa559f248328b07bf5d8607a7b) @@ -654,12 +654,9 @@ // When gui.ViewHost.AddDocumentView(testMapView); - - testMapView.VisibleChanged += (sender, args) => - { - // Then - Assert.AreNotEqual(initialExtents, map.ViewExtents); - }; + + // Then + Assert.AreNotEqual(initialExtents, map.ViewExtents); } mocks.VerifyAll();