/// <summary> /// Converts from Int to String /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="culture"></param> /// <returns></returns> public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (value is int) { var myReturn = Enum.ToObject(targetType, value); return(((ItemLocationEnum)myReturn).ToMessage()); } if (value is string) { // Convert the Message String to the Enum var myReturn = ItemLocationEnumHelper.ConvertStringToEnum((string)value); return(myReturn); } return(0); }
/// <summary> /// Converts String to Int /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="culture"></param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is Enum) { //return (int)value; return(((ItemLocationEnum)value).ToMessage()); } if (value is string) { // Convert String Enum and then Enum to Message var myEnum = ItemLocationEnumHelper.ConvertStringToEnum((string)value); var myReturn = myEnum.ToMessage(); return(myReturn); } return(0); }