Show diagram is slow

2 posts, 0 answers
  1. Maite
    Maite avatar
    33 posts
    Member since:
    Mar 2014

    Posted 06 Mar 2015 Link to this post

    I have a RadDiagram in which I load 400 items with almost 50 binding properties per-item, like for example BackgroundColor, FontSize, Width, Height, Visibility, etc…

    Example of BackgroundColor property for binding: 

    private Brush backgroundColor ;
    public Brush BackgroundColor
          get{ return backgroundColor; }
                  backgroundColor = value;

    Each item is a derived class from MyNode:NodeViewModelBase with DataTemplate:  

           <Style TargetType="telerik:RadDiagramShape">
                   <Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />                  
                   <Setter Property="Background" Value="{Binding BackgroundColor} " />                   
                   <Setter Property="BorderBrush" Value="Transparent" />

    The performance is very bad. It last up to 5 seconds to display the whole diagram with all items over it.  

    Any help to enhance the performance?
  2. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 11 Mar 2015 Link to this post

    Hello Maite,

    I already answered to this question in your other thread. However, I will paste the same answer here so that it may help others from the community.

    I can see that you have completely predefined the ControlTemplate of the RadDiagramShape. You need to keep in mind that such tremendous changes are out of our support scope. This means that the performance and the optimizations over those shapes is up to you.

    Let me give you some tips about your current implementation of the MVVM approach. In order to stick to that approach you should not hold any visual elements in your ViewModels. You should hold the information based on which you will be able to create the UI. For example instead of saving property of type Brush, you can save property of type string and preserve only the HEX code of the color. Also, saving Image is bad practice. You can save only the path to that image and achieve the same result. This also may improve the performance of your application.

    Pavel R. Pavlov

    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.

Back to Top