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

How to know the RadDiagram change?

1 Answer 106 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 26 May 2016, 11:08 AM
Hi, I want to save a RadDiagram to a file just when it changed. How to know the RadDiagram has changed? like isDirty property

1 Answer, 1 is accepted

Sort by
1
Dinko | Tech Support Engineer
Telerik team
answered on 27 May 2016, 12:59 PM
Hi Jonathan,

You can try subscribing to the CommandExecuted event of the RadDiagram. In Its handler e.Command will show you the type of the command for every change you perform on the diagram. In addition, you can take a look at the Diagram Events help article in our documentation.

Give this event a try and let us know if this works for you.

Regards,
Dinko
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Antonio
Top achievements
Rank 2
commented on 07 Dec 2023, 01:28 AM

Dinko, thank you 
My code looks like this:

        private void Diagram_CommandExecuted(object sender, CommandRoutedEventArgs e)
        {
            if (e.ExecuteAction == ExecuteAction.Undo)
            {
                if (diagram.UndoRedoService.UndoStack.Count() == 0)
                {
                    DesignChanged = false;
                }
            }
            else
            {
                DesignChanged = true;
            }
        }

        public bool DesignChanged
        {
            get
            {
                return designChanged;
            }

            set
            {
                //diagram.IsChanged = value;
                if (designChanged != value)
                {
                    var title = mainWindow.Title.TrimEnd();
                    if (!value)
                    {
                        if (title.EndsWith("*"))
                        {
                            mainWindow.Title = title.TrimEnd('*');
                        }
                    }
                    else
                    {
                        if (!title.EndsWith("*"))
                        {
                            mainWindow.Title = title + " *";
                        }
                    }
                    designChanged = value;
                }
            }
        }

Tags
Diagram
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or