This is a migrated thread and some comments may be shown as answers.

Scroll bar goes wonky

1 Answer 109 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Hugues
Top achievements
Rank 1
Hugues asked on 17 Feb 2015, 03:51 PM
When i have about a number of item int the property grid that generate a school bar. If you scroll the scroll bar up and down, the contents of the property grid goes all wonky where the content just start to bounce and the scroll gets all mess up. It gets to the point where the property grid contents moves all the way to the top and leaves an bunch of empty space in the bottom. I have attached a screenshot of it. I need a solution for this, because i have a product that needs to ship.

Thanks,
Jerome.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Feb 2015, 01:41 PM
Hello Hugues,

Thank you for writing.

Following the provided information, I was able to reproduce the issue you are facing. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to scroll by using the mouse wheel or replace the PropertyGridTraverser and customize the MovePreviousFromDataItem method as follows:
public Form1()
{
    InitializeComponent();
 
    this.radPropertyGrid1.SelectedObject = this;
    this.radPropertyGrid1.PropertyGridElement.PropertyTableElement.Scroller.Traverser =
        new CustomPropertyGridTraverser(this.radPropertyGrid1.PropertyGridElement.PropertyTableElement);
}
 
public class CustomPropertyGridTraverser : PropertyGridTraverser
{
    public CustomPropertyGridTraverser(PropertyGridTableElement propertyGridElement) : base(propertyGridElement)
    {
    }
 
    public int Index
    {
        get
        {
            FieldInfo fi = typeof(PropertyGridTraverser).GetField("index", BindingFlags.NonPublic | BindingFlags.Instance);
            return int.Parse(fi.GetValue(this).ToString());
        }
        set
        {
            FieldInfo fi = typeof(PropertyGridTraverser).GetField("index", BindingFlags.NonPublic | BindingFlags.Instance);
            fi.SetValue(this, value);
        }
    }
 
    public int GroupIndex
    {
        get
        {
            FieldInfo fi = typeof(PropertyGridTraverser).GetField("groupIndex", BindingFlags.NonPublic | BindingFlags.Instance);
            return int.Parse(fi.GetValue(this).ToString());
        }
    }
 
    public PropertyGridTableElement Element
    {
        get
        {
            FieldInfo fi = typeof(PropertyGridTraverser).GetField("propertyGridElement", BindingFlags.NonPublic | BindingFlags.Instance);
            return fi.GetValue(this) as PropertyGridTableElement ;
        }
    }
 
    public PropertyGridItemBase Item
    {
        get
        {
            FieldInfo fi = typeof(PropertyGridTraverser).GetField("item", BindingFlags.NonPublic | BindingFlags.Instance);
            return fi.GetValue(this) as PropertyGridItemBase ;
        }
        set
        {
            FieldInfo fi = typeof(PropertyGridTraverser).GetField("item", BindingFlags.NonPublic | BindingFlags.Instance);
            fi.SetValue(this, value);
        }
    }
 
    protected override bool MovePreviousFromDataItem(PropertyGridItemBase currentItem)
    {
        if (currentItem.Parent != null && currentItem.Parent.GridItems.Count > 0)
        {
            if (this.Index > 0)
            {
                PropertyGridItemBase prevItem = currentItem.Parent.GridItems[--this.Index];
                if (prevItem.Expandable && (prevItem.Expanded || this.TraverseHirarchy))
                {
                    prevItem = this.GetLastChild(prevItem);
                }
 
                this.Item = prevItem;
                return true;
            }
 
            this.Item = currentItem.Parent;
            this.Index = -1;
            if (currentItem.Parent.Parent != null)
            {
                this.Index = currentItem.Parent.Parent.GridItems.IndexOf(currentItem.Parent as PropertyGridItem);
            }
            else
            {
                if (this.Element.CollectionView.Groups.Count == 0)
                {
                    this.Index = this.Element.CollectionView.IndexOf(currentItem.Parent as PropertyGridItem);
                }
                else
                {
                    this.Index = this.Element.CollectionView.Groups[this.GroupIndex].IndexOf(currentItem.Parent as PropertyGridItem);
                }
            }
            return true;
        }
        return base.MovePreviousFromDataItem(currentItem);
    }
}

Regards,
Dess
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PropertyGrid
Asked by
Hugues
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or