protected internal override object GetValueFromSelectedListItem(object lastSelectedValue, ListItem listItem) { DefaultableMulti lastValue = lastSelectedValue as DefaultableMulti; if (lastValue != null) { DefaultableMulti clone = (DefaultableMulti)lastValue.Clone(); clone.ValueType = listItem == null ? clone.ValueTypeForNull : (string)listItem.Value; return(clone); } return(listItem.Value); }
/// <summary> /// Converts values to a TItemType. /// </summary> /// <param name="context"></param> /// <param name="culture"></param> /// <param name="value"></param> /// <returns></returns> /// <remarks></remarks> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (context != null) { object propertyValue = context.PropertyDescriptor.GetValue(context.Instance); DefaultableMulti defaultableMulti = propertyValue as DefaultableMulti; if (value is string && defaultableMulti != null) { defaultableMulti.ValueType = (string)value; return(defaultableMulti.Clone()); } } else { return(null); } object result = base.ConvertFrom(context, culture, value); return(result); }