Files
2026-04-17 14:55:32 -04:00

27 lines
850 B
C#

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<State> 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();
}
}
}