Custom item elements not working with scroll bars

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

    Posted 13 Sep 2014 Link to this post

    Hi,

    in one of my projects I use the code you described in your "Rad Property Grid Custom Item Elements" project here. This works fine as long as you do not have a scollbar in your property grid and move it. Attached you will find a fiew screen shots which show the problem: The button is moving from one property to another. During debugging I found out that the CreateItemElement event was only fired sometimes.

    I am using UI for WinForms Q2 2014. Any help would be appreciated.

    Thanks in advance,
    Thilo
  2. Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 17 Sep 2014 Link to this post

    Hello Thilo,

    Thank you for writing.

    This is expected since the control is using UI virtualization. This means that the items are reused for different properties when you are scrolling. This is controlled by the IsCompatible method and to overcome it you can recreate the method as follows:
    public override bool IsCompatible(PropertyGridItemBase data, object context)
    {
        PropertyGridItem item = data as PropertyGridItem;
        if (item != null && item.PropertyType == typeof(string) && item.Name == "SpecialText")
        {
            return true;
        }
        return false;
    }

    I hope this helps. Should you have any other questions do not hesitate to ask.
     
    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top