Link to home
Start Free TrialLog in
Avatar of ripahoratiu
ripahoratiuFlag for Romania

asked on

Design Time: DatagridView Colums does not display the property provided by the extender

Just as simple as that. The Test property is attached to controls, ListView columns, anything I want except for Columns (in Columns Collection Editor of a DataGridView). Why? Is there something I can do?

[ProvideProperty("Test", typeof(IComponent))]
        public partial class Component1 : Component, IExtenderProvider
        {
            private Dictionary<string, string> _commponentsIntlist = new Dictionary<string, string>();
 
            [Browsable(true)]
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
            public Dictionary<string, string> ComponentsAndStatefullProp
            {
                get { return _commponentsIntlist; }
                set { _commponentsIntlist = value; }
            }
            
            public Component1()
            {
                InitializeComponent();
            }
 
            public Component1(IContainer container)
            {
                container.Add(this);
                InitializeComponent();
            }
 
            bool System.ComponentModel.IExtenderProvider.CanExtend(object obj)
            {
                if (obj.GetType() == typeof(Component1)) return false;
                if (obj is IComponent) return true;
                return false;
            }
 
            public string GetTest(IComponent component)
            {
                if (!_commponentsIntlist.ContainsKey(component.ToString()))
                {
                    _commponentsIntlist.Add(component.ToString(), "");
                }
                return (string)_commponentsIntlist[component.ToString()];
            }
 
            public void SetTest(IComponent component, string value)
            {
                if (!_commponentsIntlist.ContainsKey(component.ToString()))
                {
                    _commponentsIntlist.Add(component.ToString(), value);
                }
                else
                    _commponentsIntlist[component.ToString()] = value;
            }
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ripahoratiu
ripahoratiu
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial