void PlotCanvas_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((DataContext != null) && (DataContext is PlotGenerator)) { plot = (PlotGenerator)DataContext; UpdatePlot(); } }
public MainWindow() { plot = new PlotGenerator(); plot.Compile(); double x = Math.Sin(1.0); this.DataContext = this; InitializeComponent(); StartValueTextBox.DataContext = plot.StartValueFunction; EndValueTextBox.DataContext = plot.EndValueFunction; AddFunctionButton.Click += new RoutedEventHandler(AddFunctionButton_Click); UpdateButton.Click += new RoutedEventHandler(UpdateButton_Click); }