protected virtual void ScanProperties()
        {
            Properties.Clear();
            List <PropertyGridProperty> props = new List <PropertyGridProperty>();

            foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(Data))
            {
                if (!descriptor.IsBrowsable)
                {
                    continue;
                }

                PropertyGridProperty property = CreateProperty(descriptor);
                if (property != null)
                {
                    props.Add(property);
                }
            }

            IPropertyGridObject pga = Data as IPropertyGridObject;

            if (pga != null)
            {
                pga.FinalizeProperties(this, props);
            }

            props.Sort();
            foreach (PropertyGridProperty property in props)
            {
                Properties.Add(property);
            }
        }
        public virtual bool?ShowEditor(PropertyGridProperty property, object parameter)
        {
            if (property == null)
            {
                throw new ArgumentNullException("property");
            }

            Window editor = GetEditor(property, parameter);

            if (editor != null)
            {
                bool?ret;
                IPropertyGridObject go = property.DataProvider.Data as IPropertyGridObject;
                if (go != null)
                {
                    if (go.TryShowEditor(property, editor, out ret))
                    {
                        return(ret);
                    }

                    RefreshSelectedObject(editor);
                }

                ret = editor.ShowDialog();
                if (go != null)
                {
                    go.EditorClosed(property, editor);
                }
                return(ret);
            }
            return(null);
        }