/// <summary> /// Initializes a new instance of the SettingsView class. /// </summary> public SettingsView() { InitializeComponent(); if (DataContext is SettingsViewModel) { _viewModel = (SettingsViewModel) DataContext; CenterWindowButton.Command = CenterWindowCommand; } DataContextChanged += SettingsView_DataContextChanged; _parentWindow = (MetroWindow) Application.Current.MainWindow; }
void SettingsView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue is SettingsViewModel) { _viewModel = (SettingsViewModel) e.NewValue; CenterWindowButton.Command = CenterWindowCommand; } }