T
Thiago H M Fernandes [BrDevelopers]
Hi all,
I am trying to create a control that expose a collection of a custom class.
I did some like this:
// My Custom Button
[TypeConverter(typeof(ExpandableObjectConverter))]
public class HTMLEditorButton : Image {}
// My Collection of Custom Buttons
public class HTMLEditorButtonCollection : CollectionBase {}
[ParseChildren(true, "ToolBarButtons")]
[Designer(typeof(HTMLEditorServerControlDesign))]
[DefaultProperty("ToolBarButtons")]
public class HTMLEditorServerControl : WebControl, INamingContainer
{
private HTMLEditorButtonCollection toolBarButtons;
//Constructor
public HTMLEditorServerControl()
{
toolBarButtons = new HTMLEditorButtonCollection();
}
//Property
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[PersistenceModeAttribute(PersistenceMode.InnerDefaultProperty)]
[MergableProperty(false)]
[NotifyParentPropertyAttribute(true)]
[Description("Tool bar control's collection.")]
[Category("ToolBar")]
public HTMLEditorButtonCollection ToolBarButtons
{
get { return this.toolBarButtons; }
}
// Methods
protected override void CreateChildControls()
{
Controls.Clear();
if(toolBarButtons ==null)
toolBarButtons = new HTMLEditorButtonCollection();
Controls.Add(toolBarButtons);
}
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
RenderContents(writer);
}
}
The problem is, when I run the HTMLEditorButton added at design-time doesn't
apear at runtime. I tryed Google's search and MSDN but I can't found anything.
If some one could help me or give me a link to an article I will aprettiate.
Thanks,
Thiago H M Fernandes
I am trying to create a control that expose a collection of a custom class.
I did some like this:
// My Custom Button
[TypeConverter(typeof(ExpandableObjectConverter))]
public class HTMLEditorButton : Image {}
// My Collection of Custom Buttons
public class HTMLEditorButtonCollection : CollectionBase {}
[ParseChildren(true, "ToolBarButtons")]
[Designer(typeof(HTMLEditorServerControlDesign))]
[DefaultProperty("ToolBarButtons")]
public class HTMLEditorServerControl : WebControl, INamingContainer
{
private HTMLEditorButtonCollection toolBarButtons;
//Constructor
public HTMLEditorServerControl()
{
toolBarButtons = new HTMLEditorButtonCollection();
}
//Property
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[PersistenceModeAttribute(PersistenceMode.InnerDefaultProperty)]
[MergableProperty(false)]
[NotifyParentPropertyAttribute(true)]
[Description("Tool bar control's collection.")]
[Category("ToolBar")]
public HTMLEditorButtonCollection ToolBarButtons
{
get { return this.toolBarButtons; }
}
// Methods
protected override void CreateChildControls()
{
Controls.Clear();
if(toolBarButtons ==null)
toolBarButtons = new HTMLEditorButtonCollection();
Controls.Add(toolBarButtons);
}
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
RenderContents(writer);
}
}
The problem is, when I run the HTMLEditorButton added at design-time doesn't
apear at runtime. I tryed Google's search and MSDN but I can't found anything.
If some one could help me or give me a link to an article I will aprettiate.
Thanks,
Thiago H M Fernandes