[Silverlight] コードビハインドでデータバインディングを行う
// BindingModeを「OneTime」にする場合 // ※バインディングソースとなるクラスはpublicにする public class Person { public int Age { get; set; } } private Person _bindingSource = new Person() { Age = 20 }; private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { System.Windows.Data.Binding b = new System.Windows.Data.Binding(“Age”); b.Source = this._bindingSource; b.Mode = System.Windows.Data.BindingMode.OneTime; this.TextBox1.SetBinding(TextBox.TextProperty, b); } // BindingModeを「OneWay」にする場合 // バインディングソースとなるクラスにINotifyPropertyChangedを継承させる // ↓ // [...]