Created
September 28, 2015 15:16
-
-
Save sourcechord/f90597e9eb6f9116b255 to your computer and use it in GitHub Desktop.
UWPでx:Bind使ってViewModelとバインドするためのPageクラスのスニペット
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 sealed partial class MainPage : Page | |
{ | |
public MainPage() | |
{ | |
this.InitializeComponent(); | |
// DataContext変更時にViewModelプロパティの値が変わるように | |
// イベントハンドラの設定 | |
this.DataContextChanged += (s, e) => | |
{ | |
ViewModel = this.DataContext as MainPageViewModel; | |
}; | |
} | |
public MainPageViewModel ViewModel { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment