Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 448
  • Last Modified:

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

0
ripahoratiu
Asked:
ripahoratiu
1 Solution
 
ripahoratiuAuthor Commented:
OK I find my own answer. Basically the property exposed by the extender is there if you select in the property dropdown one of the column, but not in the columns collection editor. After digging a little bit the MS guys stated that the columns collection editor is not capable of doing that and probably will not be fixed soon.
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now