Пример #1
0
        /// <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;
        }
Пример #2
0
 void SettingsView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue is SettingsViewModel)
     {
         _viewModel = (SettingsViewModel) e.NewValue;
         CenterWindowButton.Command = CenterWindowCommand;
     }
 }