#0032 修复工具箱DataContext传递问题
This commit is contained in:
@@ -3,7 +3,9 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="600" d:DesignWidth="200">
|
d:DesignHeight="600" d:DesignWidth="200">
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Prism.Ioc;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using XplorePlane.ViewModels;
|
using XplorePlane.ViewModels;
|
||||||
|
|
||||||
@@ -22,12 +21,10 @@ namespace XplorePlane.Views
|
|||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext is not OperatorToolboxViewModel)
|
|
||||||
DataContext = ContainerLocator.Container.Resolve<OperatorToolboxViewModel>();
|
|
||||||
|
|
||||||
ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown;
|
ToolboxListBox.PreviewMouseLeftButtonDown += OnPreviewMouseDown;
|
||||||
ToolboxListBox.PreviewMouseMove += OnPreviewMouseMove;
|
ToolboxListBox.PreviewMouseMove += OnPreviewMouseMove;
|
||||||
Log.Debug("OperatorToolboxView 原生拖拽源已注册");
|
Log.Debug("OperatorToolboxView 原生拖拽源已注册, DataContext={Type}",
|
||||||
|
DataContext?.GetType().Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
|
private void OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
d:DesignHeight="700"
|
d:DesignHeight="700"
|
||||||
d:DesignWidth="350"
|
d:DesignWidth="350"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Prism.Ioc;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using XplorePlane.ViewModels;
|
using XplorePlane.ViewModels;
|
||||||
|
|
||||||
@@ -17,21 +15,8 @@ namespace XplorePlane.Views
|
|||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
Log.Information("PipelineEditorView DataContext 类型={Type}",
|
||||||
{
|
DataContext?.GetType().Name);
|
||||||
if (DataContext is not PipelineEditorViewModel)
|
|
||||||
{
|
|
||||||
Log.Information("PipelineEditorView DataContext 不是 PipelineEditorViewModel(当前={Type}),正在从容器解析...",
|
|
||||||
DataContext?.GetType().Name);
|
|
||||||
DataContext = ContainerLocator.Container.Resolve<PipelineEditorViewModel>();
|
|
||||||
}
|
|
||||||
Log.Information("PipelineEditorView DataContext 类型={Type}, HashCode={Hash}",
|
|
||||||
DataContext?.GetType().Name, DataContext?.GetHashCode());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Log.Error(ex, "PipelineEditorView 解析 DataContext 失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
PipelineListBox.AllowDrop = true;
|
PipelineListBox.AllowDrop = true;
|
||||||
PipelineListBox.Drop += OnOperatorDropped;
|
PipelineListBox.Drop += OnOperatorDropped;
|
||||||
|
|||||||
Reference in New Issue
Block a user