using C1.Chart;
using System;
using Windows.UI.Xaml.Data;

namespace FlexRadarIntro
{
    public class EnumConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            return value.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            if (targetType == typeof(RadarChartType))
            {
                return (RadarChartType)Enum.Parse(typeof(RadarChartType), value.ToString());
            }
            else if (targetType == typeof(Stacking))
            {
                return (Stacking)Enum.Parse(typeof(Stacking), value.ToString());
            }
            else if (targetType == typeof(Palette))
            {
                return (Palette)Enum.Parse(typeof(Palette), value.ToString());
            }

            return value;
        }
    }
}
