How I can insert the Window Close Event in my ViewModel?

Markus Freitag 3,786 Reputation points
2020-07-15T12:41:55.56+00:00

Hello,

How I can insert the Close Event in my ViewModel?

How I can access for all classes for my own Logger?

    public partial class MainWindow : Window  
    {  
        //public Logger Log;  
  
        public MainWindow()  
        {  
            InitializeComponent();  
  
            //((ViewModel)DataContext).Init();  
            //((ViewModel)DataContext).CurrentOrderNumber = "XXXXX";  
  
            //DataContext.  
            //((ViewModel)DataContext).SetLogger(Log);  
        }  
  
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)  
        {  
            int z = 0;  
        }  
    }  

12547-windowsclose-viewmodel.png

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,765 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.