private void BindStatisticsModels2(string statisticsTarget)
 {
     BacktestingStatisticsControl.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
     {
         if (statisticsTarget == "Plots") // Show statistics for any plotted points.
         {
             var plotCollections = _backtest2.GetPlotCollectionsByLabel();
             if (plotCollections.Count != 0)
             {
                 var statsModel = new PrimativeTypeStatisticsModel(plotCollections);
                 statsModel.SelectedViewableProperty = statsModel.ViewableProperties.First();
                 //statsModel.PropertyChanged += (sender, args) =>
                 //{
                 //    if (args.PropertyName == "Statistics")
                 //    {
                 //        var model = sender as PrimativeTypeStatisticsModel;
                 //        if (model != null)
                 //        {
                 //            BacktestingStatisticsControl.SetHistogramPlotterDomain(model.Statistics);
                 //        }
                 //    }
                 //};
                 BacktestingStatisticsControl.DataContext = statsModel;
             }
         }
         else // Show statistics for results (default behavior)
         {
             var results    = _backtest2.BacktestReports.Select(r => r.Results).ToList();
             var statsModel = new ComplexTypeStatisticsModel <DarkLightResults>(results);
             statsModel.SelectedViewableProperty = statsModel.ViewableProperties.First();
             //statsModel.PropertyChanged += (sender, args) =>
             //{
             //    if (args.PropertyName == "Statistics")
             //    {
             //        var model = sender as ComplexTypeStatisticsModel<DarkLightResults>;
             //        if (model != null)
             //        {
             //            BacktestingStatisticsControl.SetHistogramPlotterDomain(model.Statistics);
             //        }
             //    }
             //};
             BacktestingStatisticsControl.DataContext = statsModel;
         }
     }));
 }
 private void BindStatisticsModels(string statisticsTarget)
 {
     BacktestingStatisticsControl.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
     {
         if (statisticsTarget == "Plots") // Show statistics for any plotted points.
         {
             var plotCollections = _backtest.GetPlotCollectionsByLabel();
             if (plotCollections.Count != 0)
             {
                 var statsModel = new PrimativeTypeStatisticsModel(plotCollections);
                 statsModel.SelectedViewableProperty      = statsModel.ViewableProperties.First();
                 BacktestingStatisticsControl.DataContext = statsModel;
             }
         }
         else // Show statistics for results (default behavior)
         {
             var results    = _backtest.BacktestReports.Select(r => r.Results).ToList();
             var statsModel = new ComplexTypeStatisticsModel <DarkLightResults>(results);
             statsModel.SelectedViewableProperty      = statsModel.ViewableProperties.First();
             BacktestingStatisticsControl.DataContext = statsModel;
         }
     }));
 }