删除MainViewModel 里的兼容占位属性

This commit is contained in:
zhengxuan.zhang
2026-05-16 14:00:06 +08:00
parent 0ccf9c529e
commit 09ac6db6ab
3 changed files with 30 additions and 15 deletions
@@ -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;
+7 -10
View File
@@ -66,7 +66,7 @@
<telerik:RadRibbonGroup
telerik:ScreenTip.Title="Clipboard"
Header="文件"
IsEnabled="{Binding Path=ClipboardGroup.IsEnabled}">
>
<telerik:RadRibbonGroup.Variants>
<telerik:GroupVariant Priority="0" Variant="Large" />
</telerik:RadRibbonGroup.Variants>
@@ -390,7 +390,7 @@
</telerik:RadRibbonGroup>
<telerik:RadRibbonGroup Header="高级模块" IsEnabled="{Binding Path=CellsGroup.IsEnabled}">
<telerik:RadRibbonGroup Header="高级模块">
<telerik:RadRibbonGroup.Variants>
<telerik:GroupVariant Priority="0" Variant="Large" />
</telerik:RadRibbonGroup.Variants>
@@ -415,24 +415,22 @@
</telerik:RadRibbonTab>
<telerik:RadRibbonTab Header="3D扫描">
<telerik:RadRibbonGroup Header="扫描模式" IsEnabled="{Binding Path=LinksGroup.IsEnabled}">
<telerik:RadRibbonGroup Header="扫描模式">
<telerik:RadRibbonGroup.Variants>
<telerik:GroupVariant Priority="0" Variant="Large" />
</telerik:RadRibbonGroup.Variants>
<telerik:RadRibbonButton
telerik:ScreenTip.Description="Create a link in your document for quick access to webpages and files.&#13;&#13;Hyperlinks can also take you to places in your document."
telerik:ScreenTip.Title="Add a Hyperlink"
Command="{Binding Path=ShowHyperlinkDialog.Command}"
Content="快速扫描"
IsEnabled="{Binding Path=ShowHyperlinkDialog.IsEnabled}"
IsEnabled="False"
Size="Large"
SmallImage="/Assets/Icons/quick-scan.png" />
<telerik:RadRibbonButton
telerik:ScreenTip.Description="Create a link in your document for quick access to webpages and files.&#13;&#13;Hyperlinks can also take you to places in your document."
telerik:ScreenTip.Title="Add a Hyperlink"
Command="{Binding Path=ShowHyperlinkDialog.Command}"
Content="螺旋扫描"
IsEnabled="{Binding Path=ShowHyperlinkDialog.IsEnabled}"
IsEnabled="False"
Size="Large"
SmallImage="/Assets/Icons/spiral.png" />
</telerik:RadRibbonGroup>
@@ -455,11 +453,10 @@
<telerik:RadRibbonGroup
telerik:ScreenTip.Description="Show the Alignment tab of the Format Cells dialog box."
telerik:ScreenTip.Title="Format Cells: Alignment"
DialogLauncherCommand="{Binding Path=ShowFormatCellsDialog.Command}"
DialogLauncherCommandParameter="Alignment"
DialogLauncherVisibility="{Binding Path=ShowFormatCellsDialog.IsEnabled, Converter={StaticResource BoolToVisibilityValueConverter}}"
DialogLauncherVisibility="Collapsed"
Header="硬件"
IsEnabled="{Binding Path=AlignmentGroup.IsEnabled}">
IsEnabled="True">
<telerik:RadRibbonGroup.Variants>
<telerik:GroupVariant Priority="0" Variant="Large" />
</telerik:RadRibbonGroup.Variants>
@@ -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<NavigationPropertyPanelViewModel>();
DataContext = _viewModel;
return;
}
_viewModel = bootstrapper.Container.Resolve<NavigationPropertyPanelViewModel>();
DataContext = _viewModel;
}
/// <summary>