|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problems with CollectionEditorI'm using a custom collection with custom items to be edited with a custom CollectionEditor. 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 CollectionEditor'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 CollectionEditor 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 CollectionEditor 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")] [DesignerSerializationVisibility (DesignerSerializationVisibility.Visible)] public string Language { get { return m_Language; } set { m_Language = value; } } [Category ("Attribute")] [DesignerSerializationVisibility (DesignerSerializationVisibility.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 : CollectionEditor { private Type[] m_Types; public LabelsEditor (Type type) : base(type) { m_Types = new Type[] {typeof (Label)}; } protected override Type[] CreateNewItemTypes() { return m_Types; } protected override Type CreateCollectionItemType() { return typeof (Label); } protected override object CreateInstance(Type ItemType) { Label l = (Label) base.CreateInstance (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 CollectionEditor 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 CollectionEditor showing different behaviors. Could this be a Regional Settings issue? Thanks, Andreas |
|||||||||||||||||||||||