.NET 1.1: editor for custom collection

  • Thread starter Harlan Messinger
  • Start date
H

Harlan Messinger

I have a web control (call it X) that inherits from Panel and that has
the following member data and property:

private System.Collections.ArrayList items =
new System.Collections.ArrayList();

[Category("Behavior"),
Editor(typeof(XYZ.Harlan.Editors.CollectionEditor),
typeof(ComponentEditor))]
public System.Collections.ArrayList Items
{
get { return items; }
}

The Items will be a collection of objects of type NavBarItem.

I've defined the CollectionEditor class in namespace XYZ.Harlan.Editors,
inheriting it from
System.Windows.Forms.Design.WindowsFormsComponentEditor, and defining a
corresponding CollectionEditorPage, inherited from
System.Windows.Forms.Design.ComponentEditorPage

When I add an X control to a Web form, the Items properties shows up in
the property browser. Next to it, it reads "Collection", and it gives me
the "..." button to click to bring up an editor window. However, the
editor it's opening is the default "Object Collection Editor", just as
it does if I remove the Editor attribute from the definition of the
Items property.

What am I overlooking that is keeping my custom editor from being loaded?

Another question: if I wanted to use the default editor, how would I go
about it? Currently it thinks the item currently selected on the left is
nothing more than an Object, and only shows one property, Value, grayed
out on the right. How would I get it to treat an item as the NavBarItem
that it is, and show its properties, instead of as an Object? Or does it
not work this way?
 
H

Harlan Messinger

Never mind. An editor is for a whole component--and I had tried this
previously with a whole component and it worked, which is why I was
surprised this time. I think I was supposed to make a designer.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top