Created
March 15, 2017 06:36
-
-
Save peyangu/f60647c763f623cb714ec4c6d4972a7c to your computer and use it in GitHub Desktop.
CloseActionプロパティにthis.Close()の処理を渡す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MainWindow() | |
{ | |
InitializeComponent(); | |
var mView = new ViewModel.MainViewModel(); | |
this.All.DataContext = mView; | |
// OnClose時に処理を行いたいので、Model側で閉じられるようthis.CloseをVMに渡す。 | |
if(mView.Model.CloseAction == null) | |
mView.Model.CloseAction = new Action(() => this.Close()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment