diff --git a/src/DynamoCoreWpf/NodeViewCustomization/NodeViewCustomizations/FunctionNodeViewCustomization.cs b/src/DynamoCoreWpf/NodeViewCustomization/NodeViewCustomizations/FunctionNodeViewCustomization.cs index d849381a392..f901edcc722 100644 --- a/src/DynamoCoreWpf/NodeViewCustomization/NodeViewCustomizations/FunctionNodeViewCustomization.cs +++ b/src/DynamoCoreWpf/NodeViewCustomization/NodeViewCustomizations/FunctionNodeViewCustomization.cs @@ -1,4 +1,6 @@ +using System; using System.Windows.Controls; +using System.Windows.Threading; using Dynamo.Controls; using Dynamo.Graph.Nodes.CustomNodes; using Dynamo.Graph.Workspaces; @@ -59,8 +61,6 @@ public void CustomizeView(Function function, NodeView nodeView) publishCustomNodeItem.Command = nodeView.ViewModel.DynamoViewModel.PublishSelectedNodesCommand; publishCustomNodeItem.CommandParameter = functionNodeModel; - - nodeView.UpdateLayout(); } private void EditCustomNodeProperties() @@ -136,4 +136,4 @@ public void Dispose() } } -} \ No newline at end of file +} diff --git a/src/DynamoCoreWpf/Views/Core/NodeView.xaml.cs b/src/DynamoCoreWpf/Views/Core/NodeView.xaml.cs index ada1eca3e25..20316099246 100644 --- a/src/DynamoCoreWpf/Views/Core/NodeView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Core/NodeView.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; @@ -551,6 +551,9 @@ private void OnNodeViewMouseLeave(object sender, MouseEventArgs e) { ViewModel.ZIndex = oldZIndex; + //Watch nodes doesn't have Preview so we should avoid to use any method/property in PreviewControl class due that Preview is created automatically + if (ViewModel.NodeModel != null && ViewModel.NodeModel is CoreNodeModels.Watch) return; + // If mouse in over node/preview control or preview control is pined, we can not hide preview control. if (IsMouseOver || PreviewControl.IsMouseOver || PreviewControl.StaysOpen || IsMouseInsidePreview(e) || (Mouse.Captured is DragCanvas && IsMouseInsideNodeOrPreview(e.GetPosition(this)))) return; @@ -731,6 +734,9 @@ internal void TogglePreviewControlAllowance() { previewEnabled = !previewEnabled; + //Watch nodes doesn't have Preview so we should avoid to use any method/property in PreviewControl class due that Preview is created automatically + if (ViewModel.NodeModel != null && ViewModel.NodeModel is CoreNodeModels.Watch) return; + if (previewEnabled == false && !PreviewControl.StaysOpen) { if (PreviewControl.IsExpanded) diff --git a/src/Libraries/PythonNodeModelsWpf/PythonNode.cs b/src/Libraries/PythonNodeModelsWpf/PythonNode.cs index c99a91c6181..fbbbf5b9822 100644 --- a/src/Libraries/PythonNodeModelsWpf/PythonNode.cs +++ b/src/Libraries/PythonNodeModelsWpf/PythonNode.cs @@ -7,6 +7,7 @@ using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; +using System.Windows.Threading; using Dynamo.Configuration; using Dynamo.Controls; using Dynamo.Graph.Nodes; @@ -99,8 +100,7 @@ public void CustomizeView(PythonNode nodeModel, NodeView nodeView) PythonEngineManager.Instance.AvailableEngines.CollectionChanged += PythonEnginesChanged; nodeView.MainContextMenu.Items.Add(learnMoreItem); - - nodeView.UpdateLayout(); + nodeView.MouseDown += View_MouseDown; nodeModel.DeletionStarted += NodeModel_DeletionStarted;