Below is a sample control that exposes a property that has one sub property. Can someone give me a hint as to how I can set the set the sub property. It all shows up in the designer property browser of VisualStudio just fine but I can not change it from false to true and the light bulb just isn't going off for me. I can persist it just fine thats not the problem the problem is I just can't see how to change it's value to true.
public class BoolControl : WebControl
{
public BoolControl() : base(HtmlTextWriterTag.Div)
{this.Width=Unit.Pixel(100);this.Height=Unit.Pixel(100);}
[TypeConverter(typeof(ClassPropertyConverter))]
public ClassProperty SetBool{get{return new ClassProperty();}set{}}
public class ClassProperty
{
protected bool mybool = false;
public bool MyBool{get{return mybool;}set{mybool = value;}}
}
internal class ClassPropertyConverter : ExpandableObjectConverter
{
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType )
{
if( destType == typeof(string) && value is BoolControl.ClassProperty)
{
return "How To Set Sub-Property?";
}
return base.ConvertTo(context,culture,value,destType);
}
}
}
Answering a question increases your knowledge asking a question shows your Intelligence!