Scroll bar goes wonky

2 posts, 0 answers
  1. Hugues
    Hugues avatar
    54 posts
    Member since:
    Sep 2014

    Posted 17 Feb 2015 Link to this post

    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.
  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 18 Feb 2015 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top