using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Globalization;
using Windows.UI.Xaml.Data;

namespace Helpers
{
    /// <summary>
    /// Converts an enum member to an array of all members of the enum. This converter is used
    /// in ComboBox controls representing enum type property editors.
    /// </summary>
    public class GetEnumMembersConverter: IValueConverter
    {
        public static readonly GetEnumMembersConverter Default = new GetEnumMembersConverter();


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }

        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value != null)
            {
                Type valueType = value.GetType();
                if (value is Enum)
                    return Enum.GetValues(valueType);
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
