private string HiddenProperties(IPropertyBag propertyBag, ContextValueCollection contexts)
        {
            string hidden = String.Empty;
            string props  = String.Empty;
            ContextValueCollection saved_context = null;


            hidden = PropertyBagHelper.ReadPropertyBag <string>(propertyBag, "HiddenProperties", "Properties,Namespaces");

            if (hidden == null)
            {
                return("Properties,Namespaces");
            }

            props = PropertyBagHelper.ReadPropertyBag <string>(propertyBag, "Properties", String.Empty);

            saved_context = ContextValueCollection.Deserialize(props);


            foreach (ContextValue context in saved_context)
            {
                if (contexts.Contains(context) == false)
                {
                    if (hidden.IndexOf(context.ToString()) < 0)
                    {
                        hidden = String.Format("{0},{1}", hidden, context.ToString());
                    }
                }
            }


            return(hidden.Replace(",,", ","));
        }
        public void Load(IPropertyBag propertyBag, int errorLog)
        {
            object val = ReadProperty(propertyBag, "Namespaces");

            if (val != null)
            {
                Namespaces.SetCollection((string)val);
            }



            val = ReadProperty(propertyBag, "Properties");

            if (val != null)
            {
                Properties            = ContextValueCollection.Deserialize((string)val);
                Properties.Namespaces = Namespaces;
            }



            foreach (ContextValue context in Properties)
            {
                string name = String.Format("{0}.{1}", context.Prefix, context.Key);

                val = ReadProperty(propertyBag, name);

                if (val != null)
                {
                    context.Value = (string)val;
                }
            }
        }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            //If unchanged return original collection or else create a new one.
            string state = ((ContextValueCollection)value).Serialize();

            ContextValueCollection coll = (ContextValueCollection)_editor.EditValue(context, provider, value);

            string new_state = coll.Serialize();

            if (state != new_state)
            {
                coll = ContextValueCollection.Deserialize(new_state);
            }

            return(coll);
        }