This class serves as base class for view models that require lifetime events.
Inheritance: BaseViewModel, ISimpleViewModel
Esempio n. 1
0
        /// <summary>
        /// Event handler for the DataContextChanged event.
        /// Registers an event handler for the ViewModel's CloseRequest event.
        /// </summary>
        /// <param name="sender">Sender of the event (this class itself).</param>
        /// <param name="e">Event args of the event.</param>
        private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            _viewModel = e.NewValue as SimpleViewModel;

            if (_viewModel != null)
            {
                _viewModel.CloseRequest += ViewModelCloseRequest;
            }
        }
        /// <summary>
        /// Event handler for the DataContextChanged event.
        /// Registers an event handler for the ViewModel's CloseRequest event.
        /// </summary>
        /// <param name="sender">Sender of the event (this class itself).</param>
        /// <param name="e">Event args of the event.</param>
        private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            _viewModel = e.NewValue as SimpleViewModel;

            if (_viewModel != null)
            {
                _viewModel.CloseRequest += ViewModelCloseRequest;
            }
        }