/// <summary>
        /// Set data context.
        /// </summary>
        /// <param name="trajectoryData">Trajectory data.</param>
        public void SetDataContext(VisualSingleTrajectory trajectoryData)
        {
            DataContext = trajectoryData;

            VisualConstantSamples visualConstantSamples = new VisualConstantSamples();
            visualConstantSamples.Samples = trajectoryData.Means;
            visualConstantSamples.Deviations = trajectoryData.StandardDeviations;
            visualConstantSamples.TimeAxis = trajectoryData.TimeAxis;
            visualConstantSamples.YAxis = trajectoryData.YAxis;
            _meanGraph.SetDataContext(visualConstantSamples);

            VisualLinerSamples visualLinerSamples = new VisualLinerSamples();
            visualLinerSamples.Samples = trajectoryData.AuxiliaryParameters;
            visualLinerSamples.TimeAxis = trajectoryData.TimeAxis;
            visualLinerSamples.YAxis = trajectoryData.YAxis;
            _auxiliaryParameterGraph.SetDataContext(visualLinerSamples);

            visualLinerSamples = new VisualLinerSamples();
            visualLinerSamples.Samples = trajectoryData.GeneratedParameters;
            visualLinerSamples.TimeAxis = trajectoryData.TimeAxis;
            visualLinerSamples.YAxis = trajectoryData.YAxis;
            _parameterGraph.SetDataContext(visualLinerSamples);

            _hightlighFrames.SelectedFrames = trajectoryData.SelectedFrameIndexes;
            _hightlighFrames.HighlightFrames = trajectoryData.HoverFrameIndexes;
            _hightlighFrames.TimeAxis = trajectoryData.TimeAxis;

            _frameline.TimeAxis = trajectoryData.TimeAxis;

            _trajectoryData = trajectoryData;
        }
        /// <summary>
        /// Create trajectories.
        /// </summary>
        public void CreateTrajectories()
        {
            _trajectoryGrid.Children.Clear();
            _parameterGraphs.Clear();
            _auxiliaryParameterGraphs.Clear();
            _meanGraphs.Clear();
            _trajectoryData.LinkAxis();

            foreach (VisualSingleTrajectory traj in _trajectoryData.Trajectories)
            {
                VisualLinerSamples visualLinerSamples = new VisualLinerSamples();
                visualLinerSamples.TimeAxis = traj.TimeAxis;
                visualLinerSamples.YAxis = traj.YAxis;
                visualLinerSamples.Samples = traj.GeneratedParameters;
                IntervalLinerGraph paraGraph = new IntervalLinerGraph();
                paraGraph.CurveStroke = parameterTrajectoryStroke.Brush;
                paraGraph.CurveStrokeThickness = parameterTrajectoryStroke.Thickness;
                paraGraph.Lowerbound = IntervalLinerGraph.DefaultLowerBound;
                paraGraph.Upperbound = IntervalLinerGraph.DefaultUpperBound;
                paraGraph.SetDataContext(visualLinerSamples);

                visualLinerSamples = new VisualLinerSamples();
                visualLinerSamples.TimeAxis = traj.TimeAxis;
                visualLinerSamples.YAxis = traj.YAxis;
                visualLinerSamples.Samples = traj.AuxiliaryParameters;
                IntervalLinerGraph auxiliaryGraph = new IntervalLinerGraph();
                auxiliaryGraph.CurveStroke = auxiliaryParameterTrajectoryStroke.Brush;
                auxiliaryGraph.CurveStrokeThickness = parameterTrajectoryStroke.Thickness;
                auxiliaryGraph.Lowerbound = IntervalLinerGraph.DefaultLowerBound;
                auxiliaryGraph.Upperbound = IntervalLinerGraph.DefaultUpperBound;
                auxiliaryGraph.SetDataContext(visualLinerSamples);

                VisualConstantSamples visualConstantSamples = new VisualConstantSamples();
                visualConstantSamples.TimeAxis = traj.TimeAxis;
                visualConstantSamples.YAxis = traj.YAxis;
                visualConstantSamples.Samples = traj.Means;
                visualConstantSamples.Deviations = traj.StandardDeviations;
                IntervalConstantGraph meanGraph = new IntervalConstantGraph();
                meanGraph.Lowerbound = IntervalConstantGraph.DefaultLowerBound;
                meanGraph.Upperbound = IntervalConstantGraph.DefaultUpperBound;
                meanGraph.SetDataContext(visualConstantSamples);

                Binding binding = new Binding("ActualWidth");
                binding.Source = _graphSystem;
                paraGraph.SetBinding(IntervalLinerGraph.WidthProperty, binding);
                auxiliaryGraph.SetBinding(IntervalLinerGraph.WidthProperty, binding);
                meanGraph.SetBinding(IntervalConstantGraph.WidthProperty, binding);
                binding = new Binding("ActualHeight");
                binding.Source = _graphSystem;
                paraGraph.SetBinding(IntervalLinerGraph.HeightProperty, binding);
                auxiliaryGraph.SetBinding(IntervalLinerGraph.HeightProperty, binding);
                meanGraph.SetBinding(IntervalConstantGraph.HeightProperty, binding);

                _parameterGraphs.Add(paraGraph);
                _auxiliaryParameterGraphs.Add(auxiliaryGraph);
                _meanGraphs.Add(meanGraph);
            }

            if (_dimensionGraphData.DisplayController.TrajectoryDisplayController.ModelDataShowed)
            {
                foreach (IntervalConstantGraph graph in _meanGraphs)
                {
                    _trajectoryGrid.Children.Add(graph);
                }
            }

            if (_dimensionGraphData.DisplayController.TrajectoryDisplayController.TrajectoryShowed)
            {
                foreach (IntervalLinerGraph graph in _parameterGraphs)
                {
                    _trajectoryGrid.Children.Add(graph);
                }
            }

            if (_dimensionGraphData.DisplayController.AuxiliaryTrajectoryEnabled &&
                _dimensionGraphData.DisplayController.TrajectoryDisplayController.AuxiliaryTrajectoryShowed)
            {
                foreach (IntervalLinerGraph graph in _auxiliaryParameterGraphs)
                {
                    _trajectoryGrid.Children.Add(graph);
                }
            }
        }
 public void SetDataContext(VisualConstantSamples samples)
 {
     _uiElemHanldersStub.InstallUnInstallRenderHandler(samples, _samples);
     _samples = samples;
     samples.Samples.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
     {
         InvalidateVisual();
     };
     DataContext = samples;
 }