PropertyGridSection _addSection(String sectionName)
        {
            Debug.Assert(Items[sectionName] == null);


            PropertyGridSection section = new PropertyGridSection();

            section.SectionName = sectionName;

            int y = _calculateSectionsHeight();

            _sections.Add(section);

            _sectionPanel.Controls.Add(section);

            section.Top                  = y;
            section.Left                 = 0;
            section.Width                = _sectionPanel.Width;
            section.Anchor               = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            section.SizeChanged         += new EventHandler(_section_SizeChanged);
            section.SplitterMoving      += new SplitterCancelEventHandler(_section_SplitterMoving);
            section.SelectedItemChanged += new EventHandler(_section_SelectedItemChanged);
            section.Owner                = this;

            _updateSectionPositions();

            return(section);
        }
        void _removeSection(String name)
        {
            PropertyGridSection section = (PropertyGridSection)Items[name];

            Debug.Assert(section != null && _sections.Contains(section));

            section.SizeChanged -= _section_SizeChanged;
            _sections.Remove(section);

            section.Dispose();

            _updateSectionPositions();
        }
        void _section_SelectedItemChanged(object sender, EventArgs e)
        {
            if (!_updatingSelection)
            {
                _updatingSelection = true;

                _helpTextTitleLabel.Text = "";
                _helpTextLabel.Text      = "";

                PropertyGridSection selectedSection = (PropertyGridSection)sender;

                foreach (PropertyGridSection section in _sections)
                {
                    if (selectedSection != section)
                    {
                        section.ResetSelectedItem();
                    }
                    else
                    {
                        PropertyGridItem selectedItem = section.SelectedItem;

                        if (selectedItem != null)
                        {
                            if (selectedItem.Description != null)
                            {
                                _helpTextTitleLabel.Text = selectedItem.Name;
                                _helpTextLabel.Text      = selectedItem.Description;
                            }

                            _scrollToGridItem(selectedItem);
                        }
                    }
                }

                _updatingSelection = false;
            }
        }
Example #4
0
 public ItemCollection(PropertyGridSection owner)
 {
     _owner = owner;
 }