M
Martijn Saly
Hi there,
I've been building a very simple "bread crumbs" control that has a
collection of BreadCrumb objects. Works pretty alright atm. There's just
this little thing that happens every now and then.
The control has an Items property which is defined as follows:
[Category("Behavior")]
[Editor(typeof(BreadCrumbCollectionEditor),
typeof(System.Drawing.Design.UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public BreadCrumbCollection Items {
get {
if (items == null)
items = new BreadCrumbCollection();
return items;
}
}
I've got this from an MSDN sample, so it should be good, I think. The
BreadCrumbCollection is just a List<BreadCrumb> and the
BreadCrumbCollectionEditor is a CollectionEditor descendant.
The funny thing is, everytime I add new BreadCrumb objects using the
designer, the control tag gets an attribute "Items-Capacity". This attribute
is not valid for the control tag, even though it appears automatically.
I've tried declaring the Capacity property inside the BreadCrumbCollection
as protected, and that does take care of the "Items-Capacity" attribute, but
it also prevents it from being called outside the class, which may not be
desirable.
Is there a better way to solve this?
I've been building a very simple "bread crumbs" control that has a
collection of BreadCrumb objects. Works pretty alright atm. There's just
this little thing that happens every now and then.
The control has an Items property which is defined as follows:
[Category("Behavior")]
[Editor(typeof(BreadCrumbCollectionEditor),
typeof(System.Drawing.Design.UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public BreadCrumbCollection Items {
get {
if (items == null)
items = new BreadCrumbCollection();
return items;
}
}
I've got this from an MSDN sample, so it should be good, I think. The
BreadCrumbCollection is just a List<BreadCrumb> and the
BreadCrumbCollectionEditor is a CollectionEditor descendant.
The funny thing is, everytime I add new BreadCrumb objects using the
designer, the control tag gets an attribute "Items-Capacity". This attribute
is not valid for the control tag, even though it appears automatically.
I've tried declaring the Capacity property inside the BreadCrumbCollection
as protected, and that does take care of the "Items-Capacity" attribute, but
it also prevents it from being called outside the class, which may not be
desirable.
Is there a better way to solve this?