Execute code when a WPF closes

后端 未结 5 1165
悲&欢浪女
悲&欢浪女 2020-12-01 12:11

I am not familiar with using event handlers, and I was wondering if anyone had or could direct me to some code that shows how to use an event handler that will execute code

5条回答
  •  广开言路
    2020-12-01 12:44

    Josh Smith's article on MVVM has a nice example of ViewModels that are part of a workspace and what to do on close. This architecture can be expanded beyond just your window being closed, but cleaning up ViewModels, etc.

    Josh Smith MVVM example

    In Figure 7 he describes the situation you are talking about. Hope this helps!

提交回复
热议问题