473,651 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CollectionEdito r - Strange behavior: overriden SetItems not being called

Hi!

I'm using a custom collection with custom items to be edited with a custom
CollectionEdito r. This set of functionality is to be a part of a plugin for
a SharpDevelop-based application.
The strange thing now is that my derived CollectionEdito r's SetItems method
is called when testing the collection editing within a small test
application,
but is NOT called when tested from within the SharpDevelop environment.
Thus whenever I add collection items by clicking Add in the CollectionEdito r
window and then click OK to save those new items, these are lost within
the SharpDevelop application.
What is the reason for SetItems to be called upon clicking the OK button in
the CollectionEdito r window? And what might be the reason for SetItems not
being called although I have modified collection items?

This is the code I'm using:

// This is one single custom item within the collection.
public class Label
{
private string m_Language;
private string m_Value;

[Category ("Attribute" )]
[DesignerSeriali zationVisibilit y (DesignerSerial izationVisibili ty.Visible)]
public string Language
{
get
{
return m_Language;
}
set
{
m_Language = value;
}
}
[Category ("Attribute" )]
[DesignerSeriali zationVisibilit y (DesignerSerial izationVisibili ty.Visible)]
public string Value
{
get
{
return m_Value;
}
set
{
m_Value = value;
}
}
}

// This is the custom collection containing objects of type "Label".
public class Labels : CollectionBase
{
// ... (contents omitted for brevity) ...
}
// This is my editor for the Label collection
public class LabelsEditor : CollectionEdito r
{
private Type[] m_Types;

public LabelsEditor (Type type) : base(type)
{
m_Types = new Type[] {typeof (Label)};
}

protected override Type[] CreateNewItemTy pes()
{
return m_Types;
}

protected override Type CreateCollectio nItemType()
{
return typeof (Label);
}

protected override object CreateInstance( Type ItemType)
{
Label l = (Label) base.CreateInst ance (typeof (Label));
return l;
}

protected override object SetItems(object editValue, object[] value)
{
base.SetItems (editValue, value);
return editValue;
}
}
What needs to be done to make the CollectionEdito r call the SetItems method
in any case? Sorry for possibly being a bit unspecific but I have no idea
where to check for hints about CollectionEdito r showing different behaviors.

Thanks,
Andreas
Jan 9 '06 #1
0 1587

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1356
by: m. pollack | last post by:
<I've reposted this here as it was slipping away over the horizon on the C# group Hi all, I've been writing an application that uses a class object (call it Element) that I need to expose to the user at runtime for editing. To do this, I've been using the PropertyGrid control. The Element object has a collection property that contains references to other Elements (its purpose is to allow the users to generate XML schemas at runtime, in...
9
1652
by: Karahan Celikel | last post by:
Here are three simple classes: class A { public void DoIt(B b) { DoSomething(b); } public void DoSomething(B b) {
0
1609
by: m. pollack | last post by:
Hi all I've been writing an application that uses a class object (call it Element) that I need to expose to the user at runtime for editing. To do this, I've been using the PropertyGrid control. The Element object has a collection property that contains references to other Elements (its purpose is to allow the users to generate XML schemas at runtime, in which elements can be nested to arbitrary depth). The PropertyGrid control opens an...
0
1227
by: m. pollack | last post by:
<I've reposted this as it was slipping away over the horizon Hi all, I've been writing an application that uses a class object (call it Element) that I need to expose to the user at runtime for editing. To do this, I've been using the PropertyGrid control. The Element object has a collection property that contains references to other Elements (its purpose is to allow the users to generate XML schemas at runtime, in which elements can be...
1
1794
by: Daniel Mihaita | last post by:
Hello, I have a simple issue : a collection class MyItems , derived from CollectionBase, an editor class MyItemsEditor derived from CollectionEditor, and a property DataItems of type MyItems, declared as : public MyItems DataItems{ get { return _DataItems; } set { _DataItems = value; }
0
1551
by: michael | last post by:
Hi. I have a problem using the CollectioEditor. In my custom control I have a public property that returns ItemList. ItemList is inherited from CollectionBase and contains very simple items called "TestItem" that are inherited from Control. i have added,To the TestItem class, a proprety called "ItemIcon", and I added to this property the attribute Editor(typeof(ImageUrlEditor)....). In design-time, I can access the "ItemList" property...
0
954
by: bp | last post by:
I have developped a component with a propriety of type List<BaseItem> where BaseItem is a generic class. Two classes inherit from BaseItem : Noeud and Item. Class Noeud has also a propriety of type List<BaseItem> so that we can build a tree of BaseItem and assign it to the component. I have a custom collection editor to edit the component's propriety (I gave up my first idea to implement my own CollectionForm!). I have a problem : there...
0
1139
by: Bardo | last post by:
Hi all, I am having an issue with a custom CollectionEditor. My scenario is as follows: I have a base type TypeA. I also have a TypeACollection. The TypeACollection has an Editor attribute of TypeACollectionEditor. This collection editor derives from the framework CollectionEditor, passing TypeACollection in the constructor to indicate which type it deals with. I then have TypeB, which derives from TypeA, but adds specific
7
2210
by: R.A.F. | last post by:
Hi, I'm still having my issue with my collection. I remind you the facts : - I have a class called "Row". - I have a collectionbase class named "RowsCollection" - I have a collectionEditor class called "RowsCollectionEditor". When i add a new row into the collection class, my new row should have its property Height, setup to default value = 20. This default value for
0
8357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8277
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8465
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8581
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7298
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.