diff --git a/XplorePlane/ViewModels/Main/MainViewModel.cs b/XplorePlane/ViewModels/Main/MainViewModel.cs index 7ae90db..25d7817 100644 --- a/XplorePlane/ViewModels/Main/MainViewModel.cs +++ b/XplorePlane/ViewModels/Main/MainViewModel.cs @@ -173,6 +173,12 @@ namespace XplorePlane.ViewModels public bool IsUsingLiveDetectorSource => _mainViewportService.CurrentSourceMode == MainViewportSourceMode.LiveDetector; + // Temporary compatibility properties to avoid startup binding errors before + // NavigationPropertyPanelView replaces the inherited DataContext with its own ViewModel. + public BitmapSource CameraImageSource => null; + public string CameraStatusText => string.Empty; + public string CameraPixelCoord => string.Empty; + public string DataRootPath { get => _dataRootPath; diff --git a/XplorePlane/Views/Main/MainWindow.xaml b/XplorePlane/Views/Main/MainWindow.xaml index 6ff2a08..d0ac05b 100644 --- a/XplorePlane/Views/Main/MainWindow.xaml +++ b/XplorePlane/Views/Main/MainWindow.xaml @@ -66,7 +66,7 @@ + > @@ -390,7 +390,7 @@ - + @@ -415,24 +415,22 @@ - + @@ -455,11 +453,10 @@ + IsEnabled="True"> diff --git a/XplorePlane/Views/Main/NavigationPropertyPanelView.xaml.cs b/XplorePlane/Views/Main/NavigationPropertyPanelView.xaml.cs index 39a7b9c..dd3c414 100644 --- a/XplorePlane/Views/Main/NavigationPropertyPanelView.xaml.cs +++ b/XplorePlane/Views/Main/NavigationPropertyPanelView.xaml.cs @@ -13,19 +13,31 @@ namespace XplorePlane.Views public NavigationPropertyPanelView() { InitializeComponent(); + ResolveViewModel(); Loaded += OnLoaded; } private void OnLoaded(object sender, RoutedEventArgs e) { - if (DataContext is NavigationPropertyPanelViewModel) return; + ResolveViewModel(); + } + + private void ResolveViewModel() + { + if (DataContext is NavigationPropertyPanelViewModel viewModel) + { + _viewModel = viewModel; + return; + } var bootstrapper = AppBootstrapper.Instance; - if (bootstrapper != null) + if (bootstrapper == null) { - _viewModel = bootstrapper.Container.Resolve(); - DataContext = _viewModel; + return; } + + _viewModel = bootstrapper.Container.Resolve(); + DataContext = _viewModel; } /// @@ -53,4 +65,4 @@ namespace XplorePlane.Views } } } -} \ No newline at end of file +}