public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (targetType != typeof(string)) { return(DependencyProperty.UnsetValue); } Monster.AlignmentType type = new Monster.AlignmentType(); type.Moral = (Monster.MoralAxis)((int)value / 3); type.Order = (Monster.OrderAxis)((int)value % 3); return(Monster.AlignmentText(type)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (targetType != typeof(int)) { return(DependencyProperty.UnsetValue); } Monster.AlignmentType al = Monster.ParseAlignment((string)value); int val = 0; val += (int)al.Order; val += 3 * (int)al.Moral; return(val); }