private DateTime GetTimeAtMousePointer(MouseEventArgs e)
        {
            TimelineScroller root = this.FindTimelineScroller(e.Source);

            if (root != null)
            {
                Point    point     = e.GetPosition(root);
                double   percent   = point.X / root.ActualWidth;
                var      viewRange = this.Navigator.ViewRange;
                DateTime time      = viewRange.StartTime + TimeSpan.FromTicks((long)((double)viewRange.Duration.Ticks * percent));

                // If we're currently snapping to some Visualization Object, adjust the time to the timestamp of the nearest message
                DateTime?snappedTime = null;
                PlotVisualizationObject snapToVisualizationObject = this.Container.SnapToVisualizationObject as PlotVisualizationObject;
                if (snapToVisualizationObject != null)
                {
                    snappedTime = snapToVisualizationObject.GetTimeOfNearestMessage(time, snapToVisualizationObject.SummaryData?.Count ?? 0, (idx) => snapToVisualizationObject.SummaryData[idx].OriginatingTime);
                }

                return(snappedTime ?? time);
            }

            Console.WriteLine("TimelineVisualizationPanel.GetTimeAtMousePointer() - Could not find the TimelineScroller in the tree");
            return(DateTime.UtcNow);
        }
        private void PlotVisualizationObjectView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            this.PlotVisualizationObject = (PlotVisualizationObject <TConfig>) this.DataContext;
            this.PlotVisualizationObject.PropertyChanging += this.PlotVisualizationObject_PropertyChanging;
            this.PlotVisualizationObject.PropertyChanged  += this.PlotVisualizationObject_PropertyChanged;
            this.PlotVisualizationObject.Configuration.PropertyChanged += this.Configuration_PropertyChanged;

            this.navigator = this.PlotVisualizationObject.Navigator;
            this.PlotVisualizationObject.Navigator.ViewRange.RangeChanged += this.Navigator_ViewRangeChanged;
            this.PlotVisualizationObject.Navigator.DataRange.RangeChanged += this.Navigator_DataRangeChanged;

            this.ResetSegments();
            if (this.PlotVisualizationObject.Data != null)
            {
                this.Data_CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
                this.PlotVisualizationObject.Data.DetailedCollectionChanged += this.Data_CollectionChanged;
            }

            if (this.PlotVisualizationObject.SummaryData != null)
            {
                this.SummaryData_CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
                this.PlotVisualizationObject.SummaryData.DetailedCollectionChanged += this.SummaryData_CollectionChanged;
            }
        }