32 lines
820 B
C#
32 lines
820 B
C#
using System;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Markup.Xaml;
|
|
using PortfolioManager.ViewModels;
|
|
using ScottPlot.Avalonia;
|
|
|
|
namespace PortfolioManager.Views;
|
|
|
|
public partial class ScottPlotView : UserControl
|
|
{
|
|
public ScottPlotView()
|
|
{
|
|
this.DataContextChanged += OnDataContextChanged;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void OnDataContextChanged(object sender, EventArgs e)
|
|
{
|
|
if (default != (sender as ScottPlotView))
|
|
{
|
|
ScottPlotView view = (sender as ScottPlotView);
|
|
PlotterWorkspaceViewModel viewModel = (DataContext as PlotterWorkspaceViewModel);
|
|
if (null!=viewModel && default == viewModel.Plotter)
|
|
{
|
|
viewModel.Plotter = new AvaPlot();
|
|
viewModel.OnPlotterLoaded(viewModel.Plotter);
|
|
}
|
|
}
|
|
}
|
|
} |