public void DrawVertivalLines(IList<DateTime> times) { var times0 = times.Select(t => dateAxis.ConvertToDouble(GetPriceStartDateContinuous(t))).ToArray(); var timeSelectedDouble = dateAxis.ConvertToDouble(GetPriceStartDateContinuous(DateStart.GetValueOrDefault())); var newLines = times0.Except(otherVLines.Select(vl => vl.Value)).ToArray(); var startDateDouble = dateAxis.ConvertToDouble(animatedTimeX[0]); var endDateDouble = dateAxis.ConvertToDouble(animatedTimeX.Last()); newLines.Where(nl => nl.Between(startDateDouble,endDateDouble)).ForEach(nl => otherVLines.Add(new VerticalLine() { Value = nl, StrokeDashArray = { 2 }, Stroke = new SolidColorBrush(Colors.MediumVioletRed), StrokeThickness = 1 }) ); otherVLines.Where(vl => !vl.Value.Between(startDateDouble,endDateDouble)).ToList().ForEach(vl => otherVLines.Remove(vl)); var lines = otherVLines.Select(t => new { l = t, d = t.Value.Abs(timeSelectedDouble) }).OrderBy(t => t.d).ToArray(); lines.Where(l => l.d == 0).Take(1).ForEach(l => l.l.StrokeThickness = 2); lines.Where(l => l.d != 0).ForEach(l => l.l.StrokeThickness = 1); }