RadDiagram batch updating

5 posts, 0 answers
  1. John Harrison
    John Harrison avatar
    23 posts
    Member since:
    May 2010

    Posted 29 Oct 2014 Link to this post

    Hi,

    Is there a way to do batch updates on diagram elements?

    We have between 20-100 elements, moving one will result in our own internal engine then repositioning others.

    This results in a lot of OnPositionChanged messages when we set the X/Y values.

    Is there a way to either batch these up, or know if the OnPositionChanged is due to a code behind change, or a user interacting with the diagram?

    Kind Regards

    PS: The forum software is very crash happy. This is 3rd time I've attempted to post this.
  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 31 Oct 2014 Link to this post

    Hi John, 
    Unfortunately we don't support this functionality out of the box at the moment but I think that there's a relatively easy workaround - you can inherit our RadDiagramShape and override the OnPositionChange method:
    protected override void OnPositionChanged(Point oldPosition, Point newPosition)
    {
        if (this.IsBatch)
        {
            this.oldPosition = oldPosition;
            this.newPosition = newPosition;
        }
        else
        {
            base.OnPositionChanged(oldPosition, newPosition);
        }
    }
    This way the base implementation (actually moving the shape, diagram logic and etc.) won't be called and you you'll only have a DependencyProperty change. Then when you've finished all the changes you'll just have to go through your shapes and resume the notifications:
     
    public bool IsBatch
    {
        get
        {
            return this.isBatch;
        }
        set
        {
            if (this.isBatch != value)
            {
                this.isBatch = value;
                if (!this.isBatch)
                    base.OnPositionChanged(this.oldPosition, this.newPosition);
            }
        }
    }
    I hope I was able to help you and if you have more questions feel free to ask.

    Regards,
    Zarko
    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. DevCraft banner
  4. John Harrison
    John Harrison avatar
    23 posts
    Member since:
    May 2010

    Posted 03 Nov 2014 in reply to Zarko Link to this post

    Hi,

    That has helped somewhat, although on a mac mini we still have some performance issues, I suspect due to CLR differences (string operations are known to be dire on OSX in silverlight)

    Thanks
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 06 Nov 2014 Link to this post

    Hello John,
    I'm glad I was able to help you. As for the performance issues - unfortunately we can't really give you any suggestions without testing your project in a similar environment (mac mini).

    Regards,
    Zarko
    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.

     
  6. John Harrison
    John Harrison avatar
    23 posts
    Member since:
    May 2010

    Posted 10 Nov 2014 in reply to Zarko Link to this post

    Hi,

    I think the performance issues are more just to do with the silverlight CLR on a mac.

    It seems to use about 10% CPU when nothing is going on (.i.e user not interacting at all with the application). Where as on a PC on idle it uses 0%.

    Thanks

Back to Top
DevCraft banner