From 50d54a982085b6f12643099d6cc722ee183061d4 Mon Sep 17 00:00:00 2001 From: Deyan Nenov Date: Tue, 18 Jun 2024 18:37:53 +0100 Subject: [PATCH 1/6] border to custom node prompt - added a weave-aligned border frame to the custom node modal window --- .../UI/Prompts/FunctionNamePrompt.xaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml index e9613dea627..3d8db19f16c 100644 --- a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml +++ b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml @@ -1,4 +1,4 @@ - @@ -379,5 +381,14 @@ Style="{DynamicResource ResourceKey=CtaButtonStyle}" TabIndex="2" /> + + From 8870aad52de337e848ee86f9875c617ef05819b6 Mon Sep 17 00:00:00 2001 From: Deyan Nenov Date: Tue, 18 Jun 2024 20:48:22 +0100 Subject: [PATCH 2/6] recenter prompt to dynamo window - setting location of the window after creation --- src/DynamoCoreWpf/PublicAPI.Unshipped.txt | 1 + .../UI/Prompts/FunctionNamePrompt.xaml | 12 +++---- .../UI/Prompts/FunctionNamePrompt.xaml.cs | 34 +++++++++++++++---- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt index f03338cf293..857d0b0212a 100644 --- a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt +++ b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt @@ -4141,6 +4141,7 @@ override Dynamo.Controls.ZoomBorder.Child.set -> void override Dynamo.Nodes.DynamoTextBox.OnLostFocus(System.Windows.RoutedEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnTextChanged(System.Windows.Controls.TextChangedEventArgs e) -> void +override Dynamo.Nodes.FunctionNamePrompt.OnClosed(System.EventArgs e) -> void override Dynamo.Nodes.StringTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.get -> System.Collections.ObjectModel.ObservableCollection override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.set -> void diff --git a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml index 3d8db19f16c..e0c6b354bf9 100644 --- a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml +++ b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml @@ -4,14 +4,12 @@ xmlns:p="clr-namespace:Dynamo.Wpf.Properties;assembly=DynamoCoreWpf" xmlns:ui="clr-namespace:Dynamo.UI" Title="{x:Static p:Resources.CustomNodePropertyWindowTitle}" - Width="450" WindowStartupLocation="CenterOwner" - WindowStyle="None"> - - - - True - + Width="450" + Height="540" + AllowsTransparency="True" + WindowStyle="None" + Background="Transparent"> diff --git a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs index 45f1e41d28f..08cc8aaebbd 100644 --- a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs +++ b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs @@ -1,10 +1,9 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using Dynamo.Controls; -using Dynamo.Utilities; using Dynamo.Wpf.Utilities; using DynamoUtilities; @@ -19,9 +18,6 @@ public FunctionNamePrompt(IEnumerable categories) { InitializeComponent(); - Owner = WpfUtilities.FindUpVisualTree(this); - WindowStartupLocation = WindowStartupLocation.CenterOwner; - nameBox.Focus(); var sortedCats = categories.ToList(); @@ -31,7 +27,10 @@ public FunctionNamePrompt(IEnumerable categories) { categoryBox.Items.Add(item); } + + this.ContentRendered += FunctionNamePrompt_ContentRendered; } + void OK_Click(object sender, RoutedEventArgs e) { @@ -119,5 +118,28 @@ private void NameBox_OnTextChanged(object sender, TextChangedEventArgs e) ErrorUnderline.Visibility = Visibility.Collapsed; } } + + #region Recenter Window + private void FunctionNamePrompt_ContentRendered(object sender, EventArgs e) + { + CenterWindow(); + } + + private void CenterWindow() + { + if (Owner != null) + { + this.Left = Owner.Left + (Owner.Width - this.ActualWidth) / 2; + this.Top = Owner.Top + (Owner.Height - this.ActualHeight) / 2; + } + } + + protected override void OnClosed(EventArgs e) + { + this.ContentRendered -= FunctionNamePrompt_ContentRendered; + + base.OnClosed(e); + } + #endregion } } From 0e383c8039188bd8bf6e24f7056b8fb14b67799a Mon Sep 17 00:00:00 2001 From: Deyan Nenov Date: Tue, 18 Jun 2024 21:32:58 +0100 Subject: [PATCH 3/6] removed protected from api --- src/DynamoCoreWpf/PublicAPI.Unshipped.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt index 857d0b0212a..f03338cf293 100644 --- a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt +++ b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt @@ -4141,7 +4141,6 @@ override Dynamo.Controls.ZoomBorder.Child.set -> void override Dynamo.Nodes.DynamoTextBox.OnLostFocus(System.Windows.RoutedEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnTextChanged(System.Windows.Controls.TextChangedEventArgs e) -> void -override Dynamo.Nodes.FunctionNamePrompt.OnClosed(System.EventArgs e) -> void override Dynamo.Nodes.StringTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.get -> System.Collections.ObjectModel.ObservableCollection override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.set -> void From ebbc25132bbcc79d53ac419a99b9d317178862bd Mon Sep 17 00:00:00 2001 From: Deyan Nenov Date: Tue, 18 Jun 2024 21:54:24 +0100 Subject: [PATCH 4/6] added protected back to API --- src/DynamoCoreWpf/PublicAPI.Unshipped.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt index f03338cf293..857d0b0212a 100644 --- a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt +++ b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt @@ -4141,6 +4141,7 @@ override Dynamo.Controls.ZoomBorder.Child.set -> void override Dynamo.Nodes.DynamoTextBox.OnLostFocus(System.Windows.RoutedEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnTextChanged(System.Windows.Controls.TextChangedEventArgs e) -> void +override Dynamo.Nodes.FunctionNamePrompt.OnClosed(System.EventArgs e) -> void override Dynamo.Nodes.StringTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.get -> System.Collections.ObjectModel.ObservableCollection override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.set -> void From b11e3b1ece5feb7ef1e5c0a1214f3e42155c85c6 Mon Sep 17 00:00:00 2001 From: Deyan Nenov Date: Wed, 19 Jun 2024 12:11:03 +0100 Subject: [PATCH 5/6] resolve the centralizing issue - finally found the real culprit - assigning the Owner from the DynamoView during initialization time was causing a different version of the Owner (DynamoView) to be used for the centralizing of the window. - finding the actual DynamoView during runtime and using only that resolved the issue - removed the code causing the issue - removed the previous 'fix' --- .../UI/Prompts/FunctionNamePrompt.xaml.cs | 31 +++---------------- .../Views/Core/DynamoView.xaml.cs | 2 -- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs index 08cc8aaebbd..c67c5b62401 100644 --- a/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs +++ b/src/DynamoCoreWpf/UI/Prompts/FunctionNamePrompt.xaml.cs @@ -1,9 +1,10 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; +using Dynamo.Controls; +using Dynamo.Utilities; using Dynamo.Wpf.Utilities; using DynamoUtilities; @@ -18,6 +19,9 @@ public FunctionNamePrompt(IEnumerable categories) { InitializeComponent(); + Owner = WpfUtilities.FindUpVisualTree(this); + WindowStartupLocation = WindowStartupLocation.CenterOwner; + nameBox.Focus(); var sortedCats = categories.ToList(); @@ -27,8 +31,6 @@ public FunctionNamePrompt(IEnumerable categories) { categoryBox.Items.Add(item); } - - this.ContentRendered += FunctionNamePrompt_ContentRendered; } @@ -118,28 +120,5 @@ private void NameBox_OnTextChanged(object sender, TextChangedEventArgs e) ErrorUnderline.Visibility = Visibility.Collapsed; } } - - #region Recenter Window - private void FunctionNamePrompt_ContentRendered(object sender, EventArgs e) - { - CenterWindow(); - } - - private void CenterWindow() - { - if (Owner != null) - { - this.Left = Owner.Left + (Owner.Width - this.ActualWidth) / 2; - this.Top = Owner.Top + (Owner.Height - this.ActualHeight) / 2; - } - } - - protected override void OnClosed(EventArgs e) - { - this.ContentRendered -= FunctionNamePrompt_ContentRendered; - - base.OnClosed(e); - } - #endregion } } diff --git a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs index dd79b7af0fd..26692f390e7 100644 --- a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs @@ -1726,8 +1726,6 @@ internal void ShowNewFunctionDialog(FunctionNamePromptEventArgs e) categoryBox = { Text = e.Category }, DescriptionInput = { Text = e.Description }, nameBox = { Text = e.Name }, - Owner = this, - WindowStartupLocation = WindowStartupLocation.CenterOwner }; if (e.CanEditName) From 832a8c16b8e5cecbf59bff989868e340b490cfd4 Mon Sep 17 00:00:00 2001 From: Deyan Nenov Date: Wed, 19 Jun 2024 14:45:57 +0100 Subject: [PATCH 6/6] remove old API entry --- src/DynamoCoreWpf/PublicAPI.Unshipped.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt index 857d0b0212a..f03338cf293 100644 --- a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt +++ b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt @@ -4141,7 +4141,6 @@ override Dynamo.Controls.ZoomBorder.Child.set -> void override Dynamo.Nodes.DynamoTextBox.OnLostFocus(System.Windows.RoutedEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.Nodes.DynamoTextBox.OnTextChanged(System.Windows.Controls.TextChangedEventArgs e) -> void -override Dynamo.Nodes.FunctionNamePrompt.OnClosed(System.EventArgs e) -> void override Dynamo.Nodes.StringTextBox.OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e) -> void override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.get -> System.Collections.ObjectModel.ObservableCollection override Dynamo.PackageManager.UI.PackageItemInternalViewModel.Items.set -> void