RadDiagram Save does not save all items

4 posts, 0 answers
  1. liviuu
    liviuu avatar
    4 posts
    Member since:
    Sep 2012

    Posted 04 Jun 2013 Link to this post

    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
  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 07 Jun 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Kevin
    Kevin avatar
    13 posts
    Member since:
    Dec 2012

    Posted 07 Dec 2014 in reply to Zarko Link to this post

    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?
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 09 Dec 2014 Link to this post

    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.

     
Back to Top