public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { if (value == null) { return(null); } if (value is IconInfo) { IconInfo icon = (IconInfo)value; if (context == null) // Requried to circumvent the Designer { if (IconInfo.ShouldSerialize(icon)) { StringBuilder serializedValue = new StringBuilder(); serializedValue.Append(icon.Url).Append("\0"); serializedValue.Append(icon.Width.ToString()).Append("\0"); serializedValue.Append(icon.Height.ToString()).Append("\0"); serializedValue.Append(icon.AlternateText).Append("\0"); serializedValue.Append(icon.ToolTip); return(serializedValue.ToString()); } else { return(string.Empty); } } else { return(icon.Url); } } } return(base.ConvertTo(context, culture, value, destinationType)); }
private bool ShouldSerializeIcon() { return(IconInfo.ShouldSerialize(_icon)); }
private bool ShouldSerializeDisabledIcon() { return(IconInfo.ShouldSerialize(_disabledIcon)); }