This is a migrated thread and some comments may be shown as answers.

RadDiagram batch updating

4 Answers 27 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
John Harrison
Top achievements
Rank 1
John Harrison asked on 29 Oct 2014, 08:57 AM
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.

4 Answers, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 31 Oct 2014, 04:30 PM
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.

 
0
John Harrison
Top achievements
Rank 1
answered on 03 Nov 2014, 02:06 PM
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
0
Zarko
Telerik team
answered on 06 Nov 2014, 09:29 AM
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.

 
0
John Harrison
Top achievements
Rank 1
answered on 10 Nov 2014, 08:40 AM
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

Tags
Diagram
Asked by
John Harrison
Top achievements
Rank 1
Answers by
Zarko
Telerik team
John Harrison
Top achievements
Rank 1
Share this question
or