using System; using System.Collections.Generic; using System.Linq; using System.Windows.Data; namespace RegionOfInterestChannels { public class StateListIndexConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (null == values || values.Length != 2) return null; if (!(values[1] is int idx) || !(values[0] is IEnumerable states) || states.Count() <= idx) return null; return states.ElementAt(idx); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }