private static void PreamblesFileChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { DynPreambleView v = o as DynPreambleView; if (v != null) { v.TheVM.LoadPreambles(v.PreamblesFile); } }
/// <summary> /// This property reflects the current preamble. It is not supposed to be set. /// (It should be made readonly, but due to a bug in WPF it would make binding to source much more difficult.) /// </summary> //public string Preamble //{ // get { return (string)GetValue(PreambleProperty); } // set { SetValue(PreambleProperty, value); } //} //public static readonly DependencyProperty PreambleProperty = // DependencyProperty.Register("Preamble", typeof(string), typeof(DynPreambleView), new UIPropertyMetadata("", PreambleChanged)); //public static readonly DependencyProperty PreambleProperty = PreamblePropertyKey.DependencyProperty; private static void PreambleChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { // Instead of binding the document property, we go the cheap way and push changes.... DynPreambleView v = o as DynPreambleView; if (v != null) { v.txtCode.Text = v.Preamble; } }