Telerik RadTreeListView poor performance

2k Views Asked by At

I'm having a little performance problem with the Telerik WPF hierarchical gridview & considering alternative 3rd party controls.

Check out this simple scenario (zip project) Its a RadTreeListView, bound up to an entity with a combobox to expand to each level. The performance is crap. I'm using the lightweight metro (windows8) style, and have overridden CreateCellElement as follows (and as recommended).

public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
{
    if (cell.Content != null && cell.DataContext == dataItem)
    {
        return (FrameworkElement)cell.Content;
    }

    return base.CreateCellElement(cell, dataItem);
}

Open it up, drag to fill the height of your screen, expand all items a couple of levels deep (using the combo, top left) and scroll around - it's extremely laggy. In my work version a similar scenario is entirely unusable, and I'm currently forced to loop through all expanded rows and dispatch 'ExpandHierarchyItems' calls which ties up the UI for ages, just to prevent a horrendous scrolling experience (extremely slow/massive UI lockups, nodes not expanded, no children, rows at wrong level). Latest version of telerik WPF, windows 7 x64 - slow on i7s, even slower on i5.

I'm now comparing this simple scenario with the alternatives (devexpress etc) ...

Has anyone got any suggestions for improving the performance? Or I'll take a definitive 'Telerik cant provide any better than this, and (something else) will' as an answer.

cross post from http://www.telerik.com/community/forums/wpf/treelist/radtreelistview-poor-performance.aspx

2

There are 2 best solutions below

0
On

I just played your demo for a couple of minutes.

An error "Key cannot be null" occurred when I tried to edit the RadTreeListView template. The ControlTemplate is added in the resources, however it cannot be applied to the control. So I cannot play the template.

For the performance, as far as I know, we could consider following aspects:

1) Layout

Looking at the visual tree of the RadTreeListView (you could use WPF Tree Visualizer), It contains several Grid recursively from the tree root down to the tree leave.

According to MSDN, The Layout System:

At its simplest, layout is a recursive system that leads to an element being sized, positioned, and drawn. More specifically, layout describes the process of measuring and arranging the members of a Panel element's Children collection. Layout is an intensive process. The larger the Children collection, the greater the number of calculations that must be made. Complexity can also be introduced based on the layout behavior defined by the Panel element that owns the collection.

A relatively simple Panel, such as Canvas, can have significantly better performance than a more complex Panel, such as Grid.

Each time that a child UIElement changes its position, it has the potential to trigger a new pass by the layout system. Therefore, it is important to understand the events that can invoke the layout system, as unnecessary invocation can lead to poor application performance. The following describes the process that occurs when the layout system is invoked.

So the deeper your tree is, the greater the calculation will be.

You should try to avoid massive layout changes at the same time and try to use simpler panels in templates (DataTemplate and ControlTemplate)

And this link offers more details In what order are Panels the most efficient in terms of render time and performance?

2) Rendering

This is related to the WPF rendering implementation. BitmapEffect is an example.

WPF bitmap effects are rendered in software mode. Any object that applies an effect will also be rendered in software. Performance is degraded the most when using Bitmap effects on large visuals or animating properties of a Bitmap effect. This is not to say that you should not use Bitmap effects in this way at all, but you should use caution and test thoroughly to ensure that your users are getting the experience you expect.

2
On

I just use WPF TreeListView. The Telerik one didn't work for us at least not fast enough.

http://www.wpftreelistview.com

Tried a couple of other grids but went with the more bare bones faster implementation they had.