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

RadDiagram Save does not save all items

3 Answers 154 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
liviuu
Top achievements
Rank 1
liviuu asked on 04 Jun 2013, 08:16 PM
Hi,

I used some code from the Demo, the radpanel with shapes.
When i drag and drop a shape on the diagram and call save, the last added shape is not saved, although it is present in the Items collection of the diagram.
What is the fix for this?
What is missing?

Best Regards

3 Answers, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 07 Jun 2013, 10:01 AM
Hi Liviu,
Unfortunately we're not aware of such issue and I wasn't able to reproduce it with our examples so I'd like to ask you for some code snippets or a sample project.
We're looking forward to hearing from you.

Regards,
Zarko
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kevin
Top achievements
Rank 1
answered on 07 Dec 2014, 08:36 PM
I noticed this too.  This happens if you try to call diagram.Save() in the ItemsChanged event.  It seems like even though the item has been added to the diagram, the Save() command doesn't know about it yet.  Not sure if there is a good workaround?
0
Zarko
Telerik team
answered on 09 Dec 2014, 12:02 PM
Hi Brent,
Thank you for the explanation. I was able to reproduce the issue and indeed the problem is that in the ItemsChanged event the adding of the shape is not fully completed.
A possible workaround will be to use a dispatcher:
private void OnDiagramItemsChanged(object sender, DiagramItemsChangedEventArgs e)
{
    this.Dispatcher.BeginInvoke(new Action(() =>
        {
            if (this.shouldSave)
                this.saved = this.diagram.Save();
        }));
}
or another event.
I hope I was able to help you.

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.

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