Skip to content

Instantly share code, notes, and snippets.

@peyangu
Created March 15, 2017 06:36
Show Gist options
  • Save peyangu/f60647c763f623cb714ec4c6d4972a7c to your computer and use it in GitHub Desktop.
Save peyangu/f60647c763f623cb714ec4c6d4972a7c to your computer and use it in GitHub Desktop.
CloseActionプロパティにthis.Close()の処理を渡す
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