Getting an "Items-Capacity" attribute without it being valid


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:

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

Is there a better way to solve this?


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question