Files
Avalonia/PortfolioManager/Views/BollingerBandView.axaml.cs
2025-07-16 18:34:00 -04:00

39 lines
1.0 KiB
C#

using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Eremex.AvaloniaUI.Controls.Utils;
using MarketData;
using PortfolioManager.ViewModels;
using ScottPlot;
using ScottPlot.Avalonia;
using ScottPlot.DataSources;
using ScottPlot.Plottables;
namespace PortfolioManager.Views;
public partial class BollingerBandView : UserControl
{
public BollingerBandView()
{
this.DataContextChanged += OnDataContextChanged;
InitializeComponent();
}
private void OnDataContextChanged(object sender, EventArgs e)
{
if (default != (sender as BollingerBandView))
{
BollingerBandView view = (sender as BollingerBandView);
PlotterWorkspaceViewModel viewModel = (DataContext as PlotterWorkspaceViewModel);
if (null!=viewModel && default == viewModel.Plotter)
{
MDTrace.WriteLine(LogLevel.DEBUG,$"Create new plot.");
viewModel.Plotter = new AvaPlot();
viewModel.OnPlotterLoaded(viewModel.Plotter);
}
}
}
}