
HOWTO : Design-time custom collection editing for custom control
Ok!
First thanks for your reply! Now I am on the right path! But if you can
please help me a bit more so I don't loose much time!
I have a class that describes a collection item :
-------------------------------------------------
public class ControlCollectionItem
{
private string sText="";
private Image iImage;
public ControlCollectionItem(string sButtonText,Image iButtonImage)
{
sText=sButtonText;
if (iButtonImage!=null)
iImage=(Image)iButtonImage.Clone();
}
Quote:
}
Here I have a collection :
--------------------------
public class ControlCollection : System.Collections.CollectionBase
{
public void Add(ControlCollectionItem gpp)
{
List.Add(gpp);
public void Remove(int index)
{
if (index > Count - 1 || index < 0)
{
System.Windows.Forms.MessageBox.Show("Index not valid!");
}
else
{
List.RemoveAt(index);
}
}
new public void Clear()
{
List.Clear();
}
public ControlCollectionItem this[int iIndex]
{
get
{
if (iIndex > Count - 1 || iIndex < 0)
return null;
else
return (GentoPickerPage)List[iIndex];
}
}
Quote:
}
Now in control I have this :
----------------------------
.
.
.
private ControlCollection controlCollection1=new ControlCollection();
public ControlCollection CollectionProperty
{
get
{
return controlCollection1;
}
Quote:
}
.
.
.
What I must implement in this property and in ControlCollectionItem
class and in ControlCollection class so that you can add items in that
collection at design time!
Thanks in advance!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!