yavsc/BookAStar/BookAStar/Converters/EnumConverter.cs

22 lines
533 B
C#

using System;
using System.Globalization;
using Xamarin.Forms;
namespace BookAStar.Converters
{
/// <summary>
/// When EnumType:int
/// </summary>
class EnumConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (int) value;
}
}
}