using System; using System.Globalization; using System.Windows.Data; namespace ytLive.Helpers; /// /// True when a log entry's sequence falls inside the range a clicked alert points at. Two numbers /// rather than a membership collection: the log list is virtualised, and rows that are already /// realised do not re-evaluate when a collection changes — but they do when a bound number changes. /// public sealed class LogInRangeConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object? parameter, CultureInfo culture) { if (values.Length < 3) return false; if (values[0] is not long sequence) return false; if (values[1] is not long from || values[2] is not long to) return false; if (from == 0 && to == 0) return false; return sequence >= from && sequence <= to; } public object[] ConvertBack(object value, Type[] targetTypes, object? parameter, CultureInfo culture) => throw new NotSupportedException(); }