Skip to content

Commit

Permalink
fix setting preferences view owner (#11792)
Browse files Browse the repository at this point in the history
  • Loading branch information
aparajit-pratap authored Jun 25, 2021
1 parent ab8b5a1 commit 56fc0bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ private void OnDebugModesClick(object sender, RoutedEventArgs e)

private void OnPreferencesWindowClick(object sender, RoutedEventArgs e)
{
var preferencesWindow = new PreferencesView(dynamoViewModel);
var preferencesWindow = new PreferencesView(this);
preferencesWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
preferencesWindow.ShowDialog();
}
Expand Down
10 changes: 6 additions & 4 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using Dynamo.Controls;
using Dynamo.Logging;
using Dynamo.ViewModels;
using Res = Dynamo.Wpf.Properties.Resources;
Expand All @@ -25,19 +26,20 @@ public partial class PreferencesView : Window
/// Constructor of Preferences View
/// </summary>
/// <param name="dynamoViewModel"> Dynamo ViewModel</param>
public PreferencesView(DynamoViewModel dynamoViewModel)
public PreferencesView(DynamoView dynamoView)
{
SetupPreferencesViewModel(dynamoViewModel);
dynViewModel = dynamoView.DataContext as DynamoViewModel;
SetupPreferencesViewModel(dynViewModel);

DataContext = dynamoViewModel.PreferencesViewModel;
dynViewModel = dynamoViewModel;
DataContext = dynViewModel.PreferencesViewModel;


InitializeComponent();
Dynamo.Logging.Analytics.TrackEvent(
Actions.Open,
Categories.Preferences);

Owner = dynamoView;
if (DataContext is PreferencesViewModel viewModelTemp)
{
viewModel = viewModelTemp;
Expand Down

0 comments on commit 56fc0bd

Please sign in to comment.